Merge branch 'develop'

# Conflicts:
#	app/build.gradle
This commit is contained in:
Thomas 2020-05-17 18:33:37 +02:00
commit d6e7343811
191 changed files with 7488 additions and 6650 deletions

View File

@ -6,8 +6,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 29
versionCode 366 versionCode 368
versionName "2.35.3" versionName "2.35.4"
multiDexEnabled true multiDexEnabled true
renderscriptTargetApi 28 as int renderscriptTargetApi 28 as int
renderscriptSupportModeEnabled true renderscriptSupportModeEnabled true
@ -87,7 +87,7 @@ dependencies {
} }
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0" annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
annotationProcessor 'com.android.support:support-annotations:28.0.0' annotationProcessor 'com.android.support:support-annotations:28.0.0'
implementation "org.conscrypt:conscrypt-android:2.2.1" implementation "org.conscrypt:conscrypt-android:2.4.0"
implementation "com.evernote:android-job:1.2.6" implementation "com.evernote:android-job:1.2.6"
implementation "com.google.code.gson:gson:2.8.5" implementation "com.google.code.gson:gson:2.8.5"
implementation "com.google.guava:guava:28.2-android" implementation "com.google.guava:guava:28.2-android"
@ -128,7 +128,7 @@ dependencies {
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.2.0' implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.2.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.github.smarteist:autoimageslider:1.3.2' implementation 'com.github.smarteist:autoimageslider:1.3.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2' //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
implementation 'com.jaredrummler:cyanea:1.0.2' implementation 'com.jaredrummler:cyanea:1.0.2'
} }

View File

@ -0,0 +1,13 @@
Added:
- 100 Mb of cache for videos (can be changed in settings)
- Bibliogram support (default: disabled)
- Ouiches support for audio
Changed:
- Closing media
- Smoother settings
Fixed:
- Peertube comments
- Some layout issues
- Some other crashes

View File

@ -0,0 +1,13 @@
Added:
- 100 Mb of cache for videos (can be changed in settings)
- Bibliogram support (default: disabled)
- Ouiches support for audio
Changed:
- Closing media
- Smoother settings
Fixed:
- Peertube comments
- Some layout issues
- Some other crashes

View File

@ -15,8 +15,8 @@ package app.fedilab.android.activities;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask; import android.os.AsyncTask;
@ -34,6 +34,7 @@ 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.constraintlayout.widget.Group; import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -175,8 +176,18 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
public void onAdminAction(APIResponse apiResponse) { public void onAdminAction(APIResponse apiResponse) {
if (apiResponse.getError() != null) { if (apiResponse.getError() != null) {
if (apiResponse.getError().getStatusCode() == 403) { if (apiResponse.getError().getStatusCode() == 403) {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK) {
style = R.style.DialogBlack;
} else {
style = R.style.Dialog;
}
AlertDialog.Builder builderInner; AlertDialog.Builder builderInner;
builderInner = new AlertDialog.Builder(AccountReportActivity.this, R.style.AppThemeDark); builderInner = new AlertDialog.Builder(AccountReportActivity.this, style);
builderInner.setTitle(R.string.reconnect_account); builderInner.setTitle(R.string.reconnect_account);
builderInner.setMessage(R.string.reconnect_account_message); builderInner.setMessage(R.string.reconnect_account_message);
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss()); builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());

View File

@ -52,7 +52,7 @@ public class BaseActivity extends CyaneaAppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
if (BuildConfig.DEBUG) { /*if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads() .detectDiskReads()
.detectDiskWrites() .detectDiskWrites()
@ -67,7 +67,7 @@ public class BaseActivity extends CyaneaAppCompatActivity {
.penaltyLog() .penaltyLog()
// .penaltyDeath() // .penaltyDeath()
.build()); .build());
} }*/
canShowActionMode = true; canShowActionMode = true;
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -0,0 +1,26 @@
package app.fedilab.android.activities;
import android.annotation.SuppressLint;
import androidx.appcompat.app.AppCompatActivity;
import com.vanniktech.emoji.EmojiManager;
import com.vanniktech.emoji.one.EmojiOneProvider;
import app.fedilab.android.helper.Helper;
/**
* Created by Thomas on 16/05/2020.
* Fragment base activity which updates security provider
*/
@SuppressLint("Registered")
public class BaseFragmentActivity extends AppCompatActivity {
static {
Helper.installProvider();
EmojiManager.install(new EmojiOneProvider());
}
}

View File

@ -1258,7 +1258,7 @@ public abstract class BaseMainActivity extends BaseActivity
int lastReleaseNoteRead = sharedpreferences.getInt(Helper.SET_POPUP_RELEASE_NOTES, 0); int lastReleaseNoteRead = sharedpreferences.getInt(Helper.SET_POPUP_RELEASE_NOTES, 0);
int versionCode = BuildConfig.VERSION_CODE; int versionCode = BuildConfig.VERSION_CODE;
if (lastReleaseNoteRead != versionCode ) { //Need to push release notes if (lastReleaseNoteRead != versionCode) { //Need to push release notes
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, BaseMainActivity.this).execute(); new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, BaseMainActivity.this).execute();
} }
@ -1279,12 +1279,12 @@ public abstract class BaseMainActivity extends BaseActivity
Button liberapay_support = dialogReleaseNoteView.findViewById(R.id.liberapay_support); Button liberapay_support = dialogReleaseNoteView.findViewById(R.id.liberapay_support);
release_title.setText(getString(R.string.release_note_title, BuildConfig.VERSION_NAME)); release_title.setText(getString(R.string.release_note_title, BuildConfig.VERSION_NAME));
release_notes.setText(finalContent); release_notes.setText(finalContent);
if( BuildConfig.DONATIONS) { if (BuildConfig.DONATIONS) {
liberapay_support.setVisibility(View.VISIBLE); liberapay_support.setVisibility(View.VISIBLE);
}else{ } else {
liberapay_support.setVisibility(View.GONE); liberapay_support.setVisibility(View.GONE);
} }
liberapay_support.setOnClickListener(v->{ liberapay_support.setOnClickListener(v -> {
Intent intentLiberapay = new Intent(Intent.ACTION_VIEW); Intent intentLiberapay = new Intent(Intent.ACTION_VIEW);
intentLiberapay.setData(Uri.parse("https://liberapay.com/tom79")); intentLiberapay.setData(Uri.parse("https://liberapay.com/tom79"));
try { try {
@ -1693,7 +1693,7 @@ public abstract class BaseMainActivity extends BaseActivity
} }
}); });
} }
if( trackingDomains != null){ if (trackingDomains != null) {
trackingDomains = null; trackingDomains = null;
} }
if (hidde_menu != null) if (hidde_menu != null)

View File

@ -60,10 +60,10 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.PlaybackControlView; import com.google.android.exoplayer2.ui.PlayerControlView;
import com.google.android.exoplayer2.ui.SimpleExoPlayerView; import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
@ -96,6 +96,7 @@ import app.fedilab.android.client.Entities.Status;
import app.fedilab.android.client.Entities.StatusDrawerParams; import app.fedilab.android.client.Entities.StatusDrawerParams;
import app.fedilab.android.client.TLSSocketFactory; import app.fedilab.android.client.TLSSocketFactory;
import app.fedilab.android.drawers.StatusListAdapter; import app.fedilab.android.drawers.StatusListAdapter;
import app.fedilab.android.helper.CacheDataSourceFactory;
import app.fedilab.android.helper.CrossActions; import app.fedilab.android.helper.CrossActions;
import app.fedilab.android.helper.FullScreenMediaController; import app.fedilab.android.helper.FullScreenMediaController;
import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.Helper;
@ -130,7 +131,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
private ScrollView peertube_information_container; private ScrollView peertube_information_container;
private Peertube peertube; private Peertube peertube;
private TextView toolbar_title; private TextView toolbar_title;
private SimpleExoPlayerView playerView; private PlayerView playerView;
private SimpleExoPlayer player; private SimpleExoPlayer player;
private boolean fullScreenMode; private boolean fullScreenMode;
private Dialog fullScreenDialog; private Dialog fullScreenDialog;
@ -278,10 +279,8 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
peertube_information_container.setVisibility(View.VISIBLE); peertube_information_container.setVisibility(View.VISIBLE);
} }
}); });
String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, null); String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
if (user_agent != null) { webview_video.getSettings().setUserAgentString(user_agent);
webview_video.getSettings().setUserAgentString(user_agent);
}
webview_video.getSettings().setAllowFileAccess(true); webview_video.getSettings().setAllowFileAccess(true);
webview_video.setWebChromeClient(mastalabWebChromeClient); webview_video.setWebChromeClient(mastalabWebChromeClient);
webview_video.getSettings().setDomStorageEnabled(true); webview_video.getSettings().setDomStorageEnabled(true);
@ -369,40 +368,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
case R.id.action_comment: case R.id.action_comment:
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) { if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
Toasty.info(PeertubeActivity.this, getString(R.string.retrieve_remote_status), Toast.LENGTH_LONG).show(); Toasty.info(PeertubeActivity.this, getString(R.string.retrieve_remote_status), Toast.LENGTH_LONG).show();
new AsyncTask<Void, Void, Void>() { new commentTask(new WeakReference<>(PeertubeActivity.this), peertube).execute();
private List<app.fedilab.android.client.Entities.Status> remoteStatuses;
private WeakReference<Context> contextReference = new WeakReference<>(PeertubeActivity.this);
@Override
protected Void doInBackground(Void... voids) {
if (peertube != null) {
APIResponse search = new API(contextReference.get()).search("https://" + peertube.getAccount().getHost() + "/videos/watch/" + peertube.getUuid());
if (search != null && search.getResults() != null) {
remoteStatuses = search.getResults().getStatuses();
}
}
return null;
}
@Override
protected void onPostExecute(Void result) {
Intent intent = new Intent(contextReference.get(), TootActivity.class);
Bundle b = new Bundle();
if (remoteStatuses == null || remoteStatuses.size() == 0) {
Toasty.error(contextReference.get(), getString(R.string.toast_error), Toast.LENGTH_SHORT).show();
return;
}
if (remoteStatuses.get(0).getReblog() != null) {
b.putParcelable("tootReply", remoteStatuses.get(0).getReblog());
} else {
b.putParcelable("tootReply", remoteStatuses.get(0));
}
intent.putExtras(b); //Put your id to your next Intent
contextReference.get().startActivity(intent);
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) { } else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
if (!peertube.isCommentsEnabled()) { if (!peertube.isCommentsEnabled()) {
Toasty.info(PeertubeActivity.this, getString(R.string.comment_no_allowed_peertube), Toast.LENGTH_LONG).show(); Toasty.info(PeertubeActivity.this, getString(R.string.comment_no_allowed_peertube), Toast.LENGTH_LONG).show();
@ -583,16 +549,24 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
if (mode == Helper.VIDEO_MODE_DIRECT) { if (mode == Helper.VIDEO_MODE_DIRECT) {
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(PeertubeActivity.this,
Util.getUserAgent(PeertubeActivity.this, "Mastalab"), null);
ExtractorMediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory) String userAgent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
.createMediaSource(Uri.parse(apiResponse.getPeertubes().get(0).getFileUrl(null, apiResponse.getPeertubes().get(0).isStreamService()))); int video_cache = sharedpreferences.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
ProgressiveMediaSource videoSource;
if (video_cache == 0) {
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(PeertubeActivity.this,
Util.getUserAgent(PeertubeActivity.this, userAgent), null);
videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(Uri.parse(apiResponse.getPeertubes().get(0).getFileUrl(null, apiResponse.getPeertubes().get(0).isStreamService())));
} else {
CacheDataSourceFactory cacheDataSourceFactory = new CacheDataSourceFactory(PeertubeActivity.this);
videoSource = new ProgressiveMediaSource.Factory(cacheDataSourceFactory)
.createMediaSource(Uri.parse(apiResponse.getPeertubes().get(0).getFileUrl(null, apiResponse.getPeertubes().get(0).isStreamService())));
}
player = ExoPlayerFactory.newSimpleInstance(PeertubeActivity.this); player = ExoPlayerFactory.newSimpleInstance(PeertubeActivity.this);
playerView.setPlayer(player); playerView.setPlayer(player);
loader.setVisibility(View.GONE); loader.setVisibility(View.GONE);
player.prepare(videoSource); player.prepare(videoSource);
player.setPlayWhenReady(true); player.setPlayWhenReady(true);
} }
@ -662,7 +636,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
}); });
} }
@Override @Override
public void onConfigurationChanged(@NotNull Configuration newConfig) { public void onConfigurationChanged(@NotNull Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
@ -745,7 +718,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
} }
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -777,7 +749,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
if (playerView != null) { if (playerView != null) {
loader.setVisibility(View.VISIBLE); loader.setVisibility(View.VISIBLE);
long position = player.getCurrentPosition(); long position = player.getCurrentPosition();
PlaybackControlView controlView = playerView.findViewById(R.id.exo_controller); PlayerControlView controlView = playerView.findViewById(R.id.exo_controller);
resolution = controlView.findViewById(R.id.resolution); resolution = controlView.findViewById(R.id.resolution);
resolution.setText(String.format("%sp", res)); resolution.setText(String.format("%sp", res));
if (mode == Helper.VIDEO_MODE_DIRECT) { if (mode == Helper.VIDEO_MODE_DIRECT) {
@ -786,11 +758,19 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
player = ExoPlayerFactory.newSimpleInstance(PeertubeActivity.this); player = ExoPlayerFactory.newSimpleInstance(PeertubeActivity.this);
playerView.setPlayer(player); playerView.setPlayer(player);
loader.setVisibility(View.GONE); loader.setVisibility(View.GONE);
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(PeertubeActivity.this, String userAgent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
Util.getUserAgent(PeertubeActivity.this, "Mastalab"), null); int video_cache = sharedpreferences.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
ProgressiveMediaSource videoSource;
ExtractorMediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory) if (video_cache == 0) {
.createMediaSource(Uri.parse(peertube.getFileUrl(res, peertube.isStreamService()))); DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(PeertubeActivity.this,
Util.getUserAgent(PeertubeActivity.this, userAgent), null);
videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(Uri.parse(peertube.getFileUrl(res, peertube.isStreamService())));
} else {
CacheDataSourceFactory cacheDataSourceFactory = new CacheDataSourceFactory(PeertubeActivity.this);
videoSource = new ProgressiveMediaSource.Factory(cacheDataSourceFactory)
.createMediaSource(Uri.parse(peertube.getFileUrl(res, peertube.isStreamService())));
}
player.prepare(videoSource); player.prepare(videoSource);
player.seekTo(0, position); player.seekTo(0, position);
player.setPlayWhenReady(true); player.setPlayWhenReady(true);
@ -809,7 +789,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
} }
private void initFullscreenDialog() { private void initFullscreenDialog() {
fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) { fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
@ -830,7 +809,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
fullScreenDialog.show(); fullScreenDialog.show();
} }
private void closeFullscreenDialog() { private void closeFullscreenDialog() {
((ViewGroup) playerView.getParent()).removeView(playerView); ((ViewGroup) playerView.getParent()).removeView(playerView);
@ -842,7 +820,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
private void initFullscreenButton() { private void initFullscreenButton() {
PlaybackControlView controlView = playerView.findViewById(R.id.exo_controller); PlayerControlView controlView = playerView.findViewById(R.id.exo_controller);
fullScreenIcon = controlView.findViewById(R.id.exo_fullscreen_icon); fullScreenIcon = controlView.findViewById(R.id.exo_fullscreen_icon);
View fullScreenButton = controlView.findViewById(R.id.exo_fullscreen_button); View fullScreenButton = controlView.findViewById(R.id.exo_fullscreen_button);
fullScreenButton.setOnClickListener(v -> { fullScreenButton.setOnClickListener(v -> {
@ -854,13 +832,12 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
} }
private void initResolution() { private void initResolution() {
PlaybackControlView controlView = playerView.findViewById(R.id.exo_controller); PlayerControlView controlView = playerView.findViewById(R.id.exo_controller);
resolution = controlView.findViewById(R.id.resolution); resolution = controlView.findViewById(R.id.resolution);
resolution.setText(String.format("%sp", peertube.getResolution().get(0))); resolution.setText(String.format("%sp", peertube.getResolution().get(0)));
resolution.setOnClickListener(v -> displayResolution()); resolution.setOnClickListener(v -> displayResolution());
} }
private void changeColor() { private void changeColor() {
if (peertube.getMyRating() != null && peertube.getMyRating().equals("like")) { if (peertube.getMyRating() != null && peertube.getMyRating().equals("like")) {
changeDrawableColor(PeertubeActivity.this, R.drawable.ic_thumb_up_peertube, R.color.positive_thumbs); changeDrawableColor(PeertubeActivity.this, R.drawable.ic_thumb_up_peertube, R.color.positive_thumbs);
@ -882,4 +859,49 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
playlists = apiResponse.getPlaylists(); playlists = apiResponse.getPlaylists();
} }
} }
private static class commentTask extends AsyncTask<Void, Void, app.fedilab.android.client.Entities.Status> {
private WeakReference<Context> contextReference;
private Peertube peertube;
commentTask(WeakReference<Context> contextReference, Peertube peertube) {
this.peertube = peertube;
this.contextReference = contextReference;
}
@Override
protected app.fedilab.android.client.Entities.Status doInBackground(Void... voids) {
List<app.fedilab.android.client.Entities.Status> remoteStatuses = null;
if (peertube != null) {
APIResponse search = new API(contextReference.get()).search("https://" + peertube.getAccount().getHost() + "/videos/watch/" + peertube.getUuid());
if (search != null && search.getResults() != null) {
remoteStatuses = search.getResults().getStatuses();
}
}
if (remoteStatuses != null && remoteStatuses.size() > 0) {
return remoteStatuses.get(0);
} else {
return null;
}
}
@Override
protected void onPostExecute(app.fedilab.android.client.Entities.Status remoteStatuses) {
Intent intent = new Intent(contextReference.get(), TootActivity.class);
Bundle b = new Bundle();
if (remoteStatuses == null) {
Toasty.error(contextReference.get(), contextReference.get().getString(R.string.toast_error), Toast.LENGTH_SHORT).show();
return;
}
if (remoteStatuses.getReblog() != null) {
b.putParcelable("tootReply", remoteStatuses.getReblog());
} else {
b.putParcelable("tootReply", remoteStatuses);
}
intent.putExtras(b);
contextReference.get().startActivity(intent);
}
}
} }

View File

@ -80,6 +80,7 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
private String videoId; private String videoId;
private Account channel; private Account channel;
@SuppressWarnings("SuspiciousMethodCalls")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -539,6 +540,7 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
List<String> tags = peertube.getTags(); List<String> tags = peertube.getTags();
if (tags != null && tags.size() > 0) { if (tags != null && tags.size() > 0) {
//noinspection ToArrayCallWithZeroLengthArrayArgument
String[] tagsA = tags.toArray(new String[tags.size()]); String[] tagsA = tags.toArray(new String[tags.size()]);
p_video_tags.setTags(tagsA); p_video_tags.setTags(tagsA);
} }

View File

@ -16,6 +16,7 @@ package app.fedilab.android.activities;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
@ -193,6 +194,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
} }
@SuppressWarnings("SuspiciousMethodCalls")
@Override @Override
public void onRetrievePeertubeChannels(APIResponse apiResponse) { public void onRetrievePeertubeChannels(APIResponse apiResponse) {
if (apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0) { if (apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0) {
@ -277,32 +279,29 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
}); });
set_upload_file.setEnabled(true); set_upload_file.setEnabled(true);
set_upload_file.setOnClickListener(new View.OnClickListener() { set_upload_file.setOnClickListener(v -> {
@Override if (ContextCompat.checkSelfPermission(PeertubeUploadActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
public void onClick(View v) { PackageManager.PERMISSION_GRANTED) {
if (ContextCompat.checkSelfPermission(PeertubeUploadActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != ActivityCompat.requestPermissions(PeertubeUploadActivity.this,
PackageManager.PERMISSION_GRANTED) { new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
ActivityCompat.requestPermissions(PeertubeUploadActivity.this, MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, return;
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
return;
}
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
intent.setType("*/*");
String[] mimetypes = {"video/*"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
startActivityForResult(intent, PICK_IVDEO);
} else {
intent.setType("video/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
startActivityForResult(chooserIntent, PICK_IVDEO);
}
} }
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
intent.setType("*/*");
String[] mimetypes = {"video/*"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
startActivityForResult(intent, PICK_IVDEO);
} else {
intent.setType("video/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
startActivityForResult(chooserIntent, PICK_IVDEO);
}
}); });
//Manage languages //Manage languages
@ -391,6 +390,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
exception.printStackTrace(); exception.printStackTrace();
} }
@SuppressLint("ApplySharedPref")
@Override @Override
public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) { public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) {
try { try {

View File

@ -154,7 +154,7 @@ public class SettingsActivity extends BaseActivity {
} }
@Override @Override
public void onDestroy(){ public void onDestroy() {
super.onDestroy(); super.onDestroy();
} }

View File

@ -737,6 +737,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
attachments.add(attachment); attachments.add(attachment);
intent.putParcelableArrayListExtra("mediaArray", attachments); intent.putParcelableArrayListExtra("mediaArray", attachments);
b.putInt("position", 1); b.putInt("position", 1);
b.putInt("bgcolor", getResources().getColor(R.color.cyanea_primary_dark));
intent.putExtras(b); intent.putExtras(b);
startActivity(intent); startActivity(intent);
}); });
@ -1330,8 +1331,13 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
return true; return true;
case R.id.action_block: case R.id.action_block:
builderInner = new AlertDialog.Builder(ShowAccountActivity.this, style); builderInner = new AlertDialog.Builder(ShowAccountActivity.this, style);
builderInner.setTitle(stringArrayConf[1]); if (relationship.isBlocking()) {
doActionAccount = API.StatusAction.BLOCK; builderInner.setTitle(stringArrayConf[5]);
doActionAccount = API.StatusAction.UNBLOCK;
} else {
builderInner.setTitle(stringArrayConf[1]);
doActionAccount = API.StatusAction.BLOCK;
}
break; break;
case R.id.action_block_instance: case R.id.action_block_instance:
builderInner = new AlertDialog.Builder(ShowAccountActivity.this, style); builderInner = new AlertDialog.Builder(ShowAccountActivity.this, style);

View File

@ -24,7 +24,6 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.net.Uri; import android.net.Uri;
@ -49,11 +48,6 @@ 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 com.r0adkll.slidr.Slidr;
import com.r0adkll.slidr.model.SlidrConfig;
import com.r0adkll.slidr.model.SlidrInterface;
import com.r0adkll.slidr.model.SlidrPosition;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -72,7 +66,7 @@ import es.dmoral.toasty.Toasty;
* Media Activity * Media Activity
*/ */
public class SlideMediaActivity extends BaseActivity implements OnDownloadInterface { public class SlideMediaActivity extends BaseFragmentActivity implements OnDownloadInterface {
int flags; int flags;
private ArrayList<Attachment> attachments; private ArrayList<Attachment> attachments;
@ -80,13 +74,13 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
private ViewPager mPager; private ViewPager mPager;
private long downloadID; private long downloadID;
private boolean fullscreen; private boolean fullscreen;
private SlidrInterface slidrInterface;
private TextView media_description; private TextView media_description;
private Handler handler; private Handler handler;
private boolean swipeEnabled;
private int minTouch, maxTouch; private int minTouch, maxTouch;
private float startX; private float startX;
private float startY; private float startY;
private int bgColor;
private BroadcastReceiver onDownloadComplete = new BroadcastReceiver() { private BroadcastReceiver onDownloadComplete = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
@ -131,21 +125,24 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
media_description = findViewById(R.id.media_description); media_description = findViewById(R.id.media_description);
final int med_desc_timeout = sharedpreferences.getInt(Helper.SET_MED_DESC_TIMEOUT, 3) * 1000; final int med_desc_timeout = sharedpreferences.getInt(Helper.SET_MED_DESC_TIMEOUT, 3) * 1000;
flags = getWindow().getDecorView().getSystemUiVisibility(); flags = getWindow().getDecorView().getSystemUiVisibility();
if (getIntent().getExtras() != null) {
mediaPosition = getIntent().getExtras().getInt("position", 1);
bgColor = getIntent().getExtras().getInt("bgcolor", -1);
}
swipeEnabled = true;
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
//actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(SlideMediaActivity.this, R.color.cyanea_primary))); actionBar.setBackgroundDrawable(new ColorDrawable(bgColor));
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
assert inflater != null; assert inflater != null;
View view = inflater.inflate(R.layout.media_action_bar, new LinearLayout(SlideMediaActivity.this), false); View view = inflater.inflate(R.layout.media_action_bar, new LinearLayout(SlideMediaActivity.this), false);
view.setBackground(new ColorDrawable(ContextCompat.getColor(SlideMediaActivity.this, R.color.cyanea_primary))); view.setBackgroundColor(bgColor);
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close); ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title); TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
ImageView media_save = getSupportActionBar().getCustomView().findViewById(R.id.media_save); ImageView media_save = actionBar.getCustomView().findViewById(R.id.media_save);
ImageView media_share = getSupportActionBar().getCustomView().findViewById(R.id.media_share); ImageView media_share = actionBar.getCustomView().findViewById(R.id.media_share);
toolbar_close.setOnClickListener(v -> finish()); toolbar_close.setOnClickListener(v -> finish());
media_save.setOnClickListener(view12 -> { media_save.setOnClickListener(view12 -> {
int position = mPager.getCurrentItem(); int position = mPager.getCurrentItem();
@ -198,8 +195,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
} }
attachments = getIntent().getParcelableArrayListExtra("mediaArray"); attachments = getIntent().getParcelableArrayListExtra("mediaArray");
if (getIntent().getExtras() != null)
mediaPosition = getIntent().getExtras().getInt("position", 1);
if (attachments == null || attachments.size() == 0) if (attachments == null || attachments.size() == 0)
finish(); finish();
@ -246,19 +242,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
} }
}); });
SlidrConfig config = new SlidrConfig.Builder()
.sensitivity(1f)
.scrimColor(Color.BLACK)
.scrimStartAlpha(0.8f)
.scrimEndAlpha(0f)
.position(SlidrPosition.VERTICAL)
.velocityThreshold(2400)
.distanceThreshold(0.25f)
.edgeSize(0.18f)
.build();
slidrInterface = Slidr.attach(SlideMediaActivity.this, config);
setFullscreen(true); setFullscreen(true);
Display display = getWindowManager().getDefaultDisplay(); Display display = getWindowManager().getDefaultDisplay();
Point size = new Point(); Point size = new Point();
@ -352,15 +336,6 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
super.onPostResume(); super.onPostResume();
} }
public void enableSliding(boolean enable) {
if (enable && !swipeEnabled) {
slidrInterface.unlock();
swipeEnabled = true;
} else if (!enable && swipeEnabled) {
slidrInterface.lock();
swipeEnabled = false;
}
}
public boolean getFullScreen() { public boolean getFullScreen() {
return this.fullscreen; return this.fullscreen;
@ -419,6 +394,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
MediaSliderFragment mediaSliderFragment = new MediaSliderFragment(); MediaSliderFragment mediaSliderFragment = new MediaSliderFragment();
bundle.putInt("position", position); bundle.putInt("position", position);
bundle.putParcelable("attachment", attachments.get(position)); bundle.putParcelable("attachment", attachments.get(position));
bundle.putInt("bgcolor", bgColor);
mediaSliderFragment.setArguments(bundle); mediaSliderFragment.setArguments(bundle);
return mediaSliderFragment; return mediaSliderFragment;
} }

View File

@ -125,7 +125,7 @@ public class WebviewConnectActivity extends BaseActivity {
webView = findViewById(R.id.webviewConnect); webView = findViewById(R.id.webviewConnect);
clearCookies(WebviewConnectActivity.this); clearCookies(WebviewConnectActivity.this);
webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptEnabled(true);
String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, null); String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
if (user_agent != null) { if (user_agent != null) {
webView.getSettings().setUserAgentString(user_agent); webView.getSettings().setUserAgentString(user_agent);
} }

View File

@ -33,7 +33,6 @@ import java.util.List;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.sqlite.DomainBlockDAO; import app.fedilab.android.sqlite.DomainBlockDAO;
import app.fedilab.android.sqlite.Sqlite; import app.fedilab.android.sqlite.Sqlite;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;

View File

@ -18,7 +18,10 @@ import android.content.Context;
import android.content.Intent; 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.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -412,6 +415,13 @@ public class API {
status.setEmojis(new ArrayList<>()); status.setEmojis(new ArrayList<>());
status.setMedia_attachments(new ArrayList<>()); status.setMedia_attachments(new ArrayList<>());
status.setVisibility("public"); status.setVisibility("public");
status.setViewType(context);
SpannableString spannableString;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
spannableString = new SpannableString(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
else
spannableString = new SpannableString(Html.fromHtml(status.getContent()));
status.setContentSpan(new SpannableString(spannableString));
i++; i++;
statuses.add(status); statuses.add(status);
} }
@ -2205,6 +2215,9 @@ public class API {
JSONObject resobj = new JSONObject(response); JSONObject resobj = new JSONObject(response);
JSONObject jsonObject = resobj.getJSONObject("software"); JSONObject jsonObject = resobj.getJSONObject("software");
String name = jsonObject.getString("name").toUpperCase(); String name = jsonObject.getString("name").toUpperCase();
if (name.compareTo("CORGIDON") == 0) {
name = "MASTODON";
}
instanceNodeInfo.setName(name); instanceNodeInfo.setName(name);
instanceNodeInfo.setVersion(jsonObject.getString("version")); instanceNodeInfo.setVersion(jsonObject.getString("version"));
instanceNodeInfo.setOpenRegistrations(resobj.getBoolean("openRegistrations")); instanceNodeInfo.setOpenRegistrations(resobj.getBoolean("openRegistrations"));
@ -3696,13 +3709,16 @@ public class API {
if (apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0) { if (apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0) {
for (Status status : apiResponse.getStatuses()) { for (Status status : apiResponse.getStatuses()) {
if (status.getMedia_attachments() != null) { if (status.getMedia_attachments() != null) {
String statusSerialized = Helper.statusToStringStorage(status); try {
for (Attachment attachment : status.getMedia_attachments()) { String statusSerialized = Helper.statusToStringStorage(status);
Status newStatus = Helper.restoreStatusFromString(statusSerialized); for (Attachment attachment : status.getMedia_attachments()) {
if (newStatus == null) Status newStatus = Helper.restoreStatusFromString(statusSerialized);
break; if (newStatus == null)
newStatus.setArt_attachment(attachment); break;
apiResponseReply.getStatuses().add(newStatus); newStatus.setArt_attachment(attachment);
apiResponseReply.getStatuses().add(newStatus);
}
} catch (Exception ignored) {
} }
} }
} }

View File

@ -500,10 +500,11 @@ public class ManageTimelines {
if (mPageReferenceMap != null) { if (mPageReferenceMap != null) {
FragmentTransaction fragTransaction = ((MainActivity) context).getSupportFragmentManager().beginTransaction(); FragmentTransaction fragTransaction = ((MainActivity) context).getSupportFragmentManager().beginTransaction();
DisplayStatusFragment displayStatusFragment = (DisplayStatusFragment) mPageReferenceMap.get(tl.getPosition()); DisplayStatusFragment displayStatusFragment = (DisplayStatusFragment) mPageReferenceMap.get(tl.getPosition());
assert displayStatusFragment != null; if (displayStatusFragment != null) {
fragTransaction.detach(displayStatusFragment); fragTransaction.detach(displayStatusFragment);
fragTransaction.attach(displayStatusFragment); fragTransaction.attach(displayStatusFragment);
fragTransaction.commit(); fragTransaction.commit();
}
} }
} }
}); });

View File

@ -310,6 +310,44 @@ public class Status implements Parcelable {
} }
} }
matcher = Helper.bibliogramPattern.matcher(content);
boolean bibliogram = sharedpreferences.getBoolean(Helper.SET_BIBLIOGRAM, false);
if (bibliogram) {
while (matcher.find()) {
final String bibliogram_directory = matcher.group(2);
String bibliogramHost = sharedpreferences.getString(Helper.SET_BIBLIOGRAM_HOST, Helper.DEFAULT_BIBLIOGRAM_HOST).toLowerCase();
content = content.replaceAll("https://" + Pattern.quote(matcher.group()), Matcher.quoteReplacement("https://" + bibliogramHost + bibliogram_directory));
content = content.replaceAll(">" + Pattern.quote(matcher.group()), Matcher.quoteReplacement(">" + bibliogramHost + bibliogram_directory));
}
}
matcher = Helper.ouichesPattern.matcher(content);
while (matcher.find()) {
Attachment attachment = new Attachment();
attachment.setType("audio");
String tag = matcher.group(1);
attachment.setId(tag);
if (tag == null) {
continue;
}
attachment.setRemote_url("http://ouich.es/mp3/" + tag + ".mp3");
attachment.setUrl("http://ouich.es/mp3/" + tag + ".mp3");
if (status.getMedia_attachments() == null) {
status.setMedia_attachments(new ArrayList<>());
}
boolean alreadyAdded = false;
for (Attachment at : status.getMedia_attachments()) {
if (tag.compareTo(at.getId()) == 0) {
alreadyAdded = true;
break;
}
}
if (!alreadyAdded) {
status.getMedia_attachments().add(attachment);
}
}
Pattern aLink = Pattern.compile("<a((?!href).)*href=\"([^\"]*)\"[^>]*(((?!</a).)*)</a>"); Pattern aLink = Pattern.compile("<a((?!href).)*href=\"([^\"]*)\"[^>]*(((?!</a).)*)</a>");
Matcher matcherALink = aLink.matcher(content); Matcher matcherALink = aLink.matcher(content);
int count = 0; int count = 0;

View File

@ -173,6 +173,7 @@ public class ArtListAdapter extends RecyclerView.Adapter implements OnPostAction
else if (status.getMedia_attachments() != null && status.getMedia_attachments().size() > 0) else if (status.getMedia_attachments() != null && status.getMedia_attachments().size() > 0)
attachments.add(status.getMedia_attachments().get(0)); attachments.add(status.getMedia_attachments().get(0));
intent.putParcelableArrayListExtra("mediaArray", attachments); intent.putParcelableArrayListExtra("mediaArray", attachments);
b.putInt("bgcolor", context.getResources().getColor(R.color.cyanea_primary_dark));
b.putInt("position", 1); b.putInt("position", 1);
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);

View File

@ -84,6 +84,7 @@ public class ImageAdapter extends RecyclerView.Adapter {
} }
intent.putParcelableArrayListExtra("mediaArray", attachmentsTmp); intent.putParcelableArrayListExtra("mediaArray", attachmentsTmp);
b.putInt("position", (viewHolder.getAdapterPosition() + 1)); b.putInt("position", (viewHolder.getAdapterPosition() + 1));
b.putInt("bgcolor", context.getResources().getColor(R.color.cyanea_primary_dark));
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);
}); });

View File

@ -1184,6 +1184,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
Bundle b = new Bundle(); Bundle b = new Bundle();
intent.putParcelableArrayListExtra("mediaArray", notification.getStatus().getMedia_attachments()); intent.putParcelableArrayListExtra("mediaArray", notification.getStatus().getMedia_attachments());
b.putInt("position", finalPosition); b.putInt("position", finalPosition);
b.putInt("bgcolor", context.getResources().getColor(R.color.cyanea_primary_dark));
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);
}); });

View File

@ -397,6 +397,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
Bundle b = new Bundle(); Bundle b = new Bundle();
intent.putParcelableArrayListExtra("mediaArray", status.getMedia_attachments()); intent.putParcelableArrayListExtra("mediaArray", status.getMedia_attachments());
b.putInt("position", 1); b.putInt("position", 1);
b.putInt("bgcolor", context.getResources().getColor(R.color.cyanea_primary_dark));
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);
}); });

View File

@ -134,6 +134,7 @@ public class PixelfedStoriesListAdapter extends RecyclerView.Adapter {
Bundle b = new Bundle(); Bundle b = new Bundle();
intent.putParcelableArrayListExtra("mediaArray", attachments); intent.putParcelableArrayListExtra("mediaArray", attachments);
b.putInt("position", 1); b.putInt("position", 1);
b.putInt("bgcolor", context.getResources().getColor(R.color.cyanea_primary_dark));
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);
}); });

View File

@ -107,6 +107,7 @@ public class SliderAdapter extends SliderViewAdapter<SliderAdapter.SliderAdapter
intent.putParcelableArrayListExtra("mediaArray", attachments); intent.putParcelableArrayListExtra("mediaArray", attachments);
b.putInt("position", (position + 1)); b.putInt("position", (position + 1));
b.putInt("bgcolor", contextWeakReference.get().getResources().getColor(R.color.cyanea_primary_dark));
intent.putExtras(b); intent.putExtras(b);
contextWeakReference.get().startActivity(intent); contextWeakReference.get().startActivity(intent);
}); });

View File

@ -608,9 +608,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
@SuppressLint({"SetJavaScriptEnabled", "ClickableViewAccessibility"}) @SuppressLint({"SetJavaScriptEnabled", "ClickableViewAccessibility"})
@Override @Override
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) { public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
context = viewHolder.itemView.getContext();
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
context = viewHolder.itemView.getContext();
if (viewHolder.getItemViewType() != HIDDEN_STATUS) { if (viewHolder.getItemViewType() != HIDDEN_STATUS) {
final ViewHolder holder = (ViewHolder) viewHolder; final ViewHolder holder = (ViewHolder) viewHolder;
@ -855,6 +857,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
holder.status_action_container.setVisibility(View.GONE); holder.status_action_container.setVisibility(View.GONE);
holder.fedilab_features.setVisibility(View.GONE);
holder.status_peertube_container.setVisibility(View.VISIBLE); holder.status_peertube_container.setVisibility(View.VISIBLE);
holder.status_peertube_reply.setOnClickListener(v -> { holder.status_peertube_reply.setOnClickListener(v -> {
AlertDialog.Builder builderInner; AlertDialog.Builder builderInner;
@ -2287,6 +2290,15 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
url = url.replaceAll("https://" + Pattern.quote(matcher.group()), Matcher.quoteReplacement("https://" + nitterHost + nitter_directory)); url = url.replaceAll("https://" + Pattern.quote(matcher.group()), Matcher.quoteReplacement("https://" + nitterHost + nitter_directory));
} }
} }
boolean bibliogram = sharedpreferences.getBoolean(Helper.SET_BIBLIOGRAM, false);
if (bibliogram) {
Matcher matcher = Helper.bibliogramPattern.matcher(url);
while (matcher.find()) {
final String bibliogram_directory = matcher.group(2);
String bibliogramHost = sharedpreferences.getString(Helper.SET_BIBLIOGRAM_HOST, Helper.DEFAULT_BIBLIOGRAM_HOST).toLowerCase();
url = url.replaceAll("https://" + Pattern.quote(matcher.group()), Matcher.quoteReplacement("https://" + bibliogramHost + bibliogram_directory));
}
}
Helper.openBrowser(context, url); Helper.openBrowser(context, url);
}); });
} else if (card.getType().toLowerCase().equals("video") && (display_video_preview || (type == RetrieveFeedsAsyncTask.Type.CONTEXT && viewHolder.getAdapterPosition() == conversationPosition))) { } else if (card.getType().toLowerCase().equals("video") && (display_video_preview || (type == RetrieveFeedsAsyncTask.Type.CONTEXT && viewHolder.getAdapterPosition() == conversationPosition))) {
@ -2296,7 +2308,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
.into(holder.webview_preview_card); .into(holder.webview_preview_card);
holder.status_cardview.setVisibility(View.GONE); holder.status_cardview.setVisibility(View.GONE);
holder.status_cardview_video.setVisibility(View.VISIBLE); holder.status_cardview_video.setVisibility(View.VISIBLE);
String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, null); String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
if (user_agent != null) { if (user_agent != null) {
holder.status_cardview_webview.getSettings().setUserAgentString(user_agent); holder.status_cardview_webview.getSettings().setUserAgentString(user_agent);
} }
@ -3393,6 +3405,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
Intent intent = new Intent(context, SlideMediaActivity.class); Intent intent = new Intent(context, SlideMediaActivity.class);
Bundle b = new Bundle(); Bundle b = new Bundle();
intent.putParcelableArrayListExtra("mediaArray", attachmentArrayList); intent.putParcelableArrayListExtra("mediaArray", attachmentArrayList);
b.putInt("bgcolor", context.getResources().getColor(R.color.cyanea_primary_dark));
b.putInt("position", finalPosition); b.putInt("position", finalPosition);
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);

View File

@ -275,7 +275,7 @@ public class ColorSettingsFragment extends PreferenceFragmentCompat implements S
entryValues[2] = String.valueOf(Helper.THEME_BLACK); entryValues[2] = String.valueOf(Helper.THEME_BLACK);
pref_theme_picker.setEntries(entries); pref_theme_picker.setEntries(entries);
int default_theme_value; int default_theme_value;
switch (theme){ switch (theme) {
case Helper.THEME_LIGHT: case Helper.THEME_LIGHT:
default_theme_value = 1; default_theme_value = 1;
break; break;

View File

@ -14,10 +14,9 @@ package app.fedilab.android.fragments;
* 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.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -27,24 +26,27 @@ import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.LoginActivity; import app.fedilab.android.activities.LoginActivity;
import app.fedilab.android.asynctasks.PostAdminActionAsyncTask; import app.fedilab.android.asynctasks.PostAdminActionAsyncTask;
import app.fedilab.android.asynctasks.RetrieveAccountsAsyncTask;
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;
import app.fedilab.android.client.Entities.Report; import app.fedilab.android.client.Entities.Report;
import app.fedilab.android.drawers.ReportsListAdapter; import app.fedilab.android.drawers.ReportsListAdapter;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.interfaces.OnAdminActionInterface; import app.fedilab.android.interfaces.OnAdminActionInterface;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -59,9 +61,7 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
private Context context; private Context context;
private AsyncTask<Void, Void, Void> asyncTask; private AsyncTask<Void, Void, Void> asyncTask;
private ReportsListAdapter reportsListAdapter; private ReportsListAdapter reportsListAdapter;
private String max_id;
private List<Report> reports; private List<Report> reports;
private RetrieveAccountsAsyncTask.Type type;
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction; private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
private boolean firstLoad; private boolean firstLoad;
private SwipeRefreshLayout swipeRefreshLayout; private SwipeRefreshLayout swipeRefreshLayout;
@ -82,7 +82,6 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
if (bundle != null) { if (bundle != null) {
unresolved = bundle.getBoolean("unresolved", true); unresolved = bundle.getBoolean("unresolved", true);
} }
max_id = null;
firstLoad = true; firstLoad = true;
flag_loading = true; flag_loading = true;
swiped = false; swiped = false;
@ -109,7 +108,7 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
mLayoutManager = new LinearLayoutManager(context); mLayoutManager = new LinearLayoutManager(context);
lv_reports.setLayoutManager(mLayoutManager); lv_reports.setLayoutManager(mLayoutManager);
lv_reports.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_reports.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(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();
@ -129,18 +128,14 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
} }
}); });
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { swipeRefreshLayout.setOnRefreshListener(() -> {
@Override reports = new ArrayList<>();
public void onRefresh() { firstLoad = true;
max_id = null; flag_loading = true;
reports = new ArrayList<>(); swiped = true;
firstLoad = true; AdminAction adminAction = new AdminAction();
flag_loading = true; adminAction.setUnresolved(unresolved);
swiped = true; asyncTask = new PostAdminActionAsyncTask(context, API.adminAction.GET_REPORTS, null, adminAction, DisplayAdminReportsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
AdminAction adminAction = new AdminAction();
adminAction.setUnresolved(unresolved);
asyncTask = new PostAdminActionAsyncTask(context, API.adminAction.GET_REPORTS, null, adminAction, DisplayAdminReportsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}); });
AdminAction adminAction = new AdminAction(); AdminAction adminAction = new AdminAction();
@ -155,15 +150,8 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
} }
/**
* Refresh report in list
*/
public void refreshFilter() {
reportsListAdapter.notifyDataSetChanged();
}
@Override @Override
public void onAttach(Context context) { public void onAttach(@NotNull Context context) {
super.onAttach(context); super.onAttach(context);
this.context = context; this.context = context;
} }
@ -191,22 +179,24 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
//Admin right not granted through the API? //Admin right not granted through the API?
if (apiResponse.getError().getStatusCode() == 403) { if (apiResponse.getError().getStatusCode() == 403) {
AlertDialog.Builder builderInner; AlertDialog.Builder builderInner;
builderInner = new AlertDialog.Builder(context, R.style.AppThemeDark); SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK) {
style = R.style.DialogBlack;
} else {
style = R.style.Dialog;
}
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(R.string.reconnect_account); builderInner.setTitle(R.string.reconnect_account);
builderInner.setMessage(R.string.reconnect_account_message); builderInner.setMessage(R.string.reconnect_account_message);
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
@Override builderInner.setPositiveButton(R.string.validate, (dialog, which) -> {
public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(context, LoginActivity.class);
dialog.dismiss(); intent.putExtra("admin", true);
} context.startActivity(intent);
});
builderInner.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(context, LoginActivity.class);
intent.putExtra("admin", true);
context.startActivity(intent);
}
}); });
builderInner.show(); builderInner.show();
} else { } else {
@ -226,8 +216,6 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
else else
textviewNoAction.setVisibility(View.GONE); textviewNoAction.setVisibility(View.GONE);
max_id = apiResponse.getMax_id();
if (swiped) { if (swiped) {
reportsListAdapter = new ReportsListAdapter(this.reports); reportsListAdapter = new ReportsListAdapter(this.reports);
lv_reports.setAdapter(reportsListAdapter); lv_reports.setAdapter(reportsListAdapter);

View File

@ -20,6 +20,7 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.net.Uri; import android.net.Uri;
@ -51,11 +52,16 @@ import com.github.chrisbanes.photoview.PhotoView;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.ui.SimpleExoPlayerView; import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import com.r0adkll.slidr.Slidr;
import com.r0adkll.slidr.model.SlidrConfig;
import com.r0adkll.slidr.model.SlidrInterface;
import com.r0adkll.slidr.model.SlidrListener;
import com.r0adkll.slidr.model.SlidrPosition;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -70,6 +76,7 @@ import app.fedilab.android.R;
import app.fedilab.android.activities.SlideMediaActivity; import app.fedilab.android.activities.SlideMediaActivity;
import app.fedilab.android.client.Entities.Attachment; import app.fedilab.android.client.Entities.Attachment;
import app.fedilab.android.client.TLSSocketFactory; import app.fedilab.android.client.TLSSocketFactory;
import app.fedilab.android.helper.CacheDataSourceFactory;
import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.Helper;
import app.fedilab.android.webview.CustomWebview; import app.fedilab.android.webview.CustomWebview;
import app.fedilab.android.webview.MastalabWebChromeClient; import app.fedilab.android.webview.MastalabWebChromeClient;
@ -105,6 +112,9 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
private ImageButton playView; private ImageButton playView;
private GLAudioVisualizationView visualizerView; private GLAudioVisualizationView visualizerView;
private View rootView; private View rootView;
private SlidrInterface slidrInterface;
private boolean swipeEnabled;
private int bgColor;
public MediaSliderFragment() { public MediaSliderFragment() {
} }
@ -118,8 +128,10 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
if (bundle != null) { if (bundle != null) {
attachment = bundle.getParcelable("attachment"); attachment = bundle.getParcelable("attachment");
} bgColor = bundle.getInt("bgcolor", R.color.black);
}
swipeEnabled = true;
message_ready = rootView.findViewById(R.id.message_ready); message_ready = rootView.findViewById(R.id.message_ready);
RelativeLayout content_audio = rootView.findViewById(R.id.content_audio); RelativeLayout content_audio = rootView.findViewById(R.id.content_audio);
@ -132,7 +144,7 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
ImageView next = rootView.findViewById(R.id.media_next); ImageView next = rootView.findViewById(R.id.media_next);
imageView = rootView.findViewById(R.id.media_picture); imageView = rootView.findViewById(R.id.media_picture);
SimpleExoPlayerView videoView = rootView.findViewById(R.id.media_video); PlayerView videoView = rootView.findViewById(R.id.media_video);
if (theme == Helper.THEME_BLACK) { if (theme == Helper.THEME_BLACK) {
changeDrawableColor(context, prev, R.color.dark_icon); changeDrawableColor(context, prev, R.color.dark_icon);
changeDrawableColor(context, next, R.color.dark_icon); changeDrawableColor(context, next, R.color.dark_icon);
@ -152,9 +164,9 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
if (!((SlideMediaActivity) context).getFullScreen()) { if (!((SlideMediaActivity) context).getFullScreen()) {
((SlideMediaActivity) context).setFullscreen(true); ((SlideMediaActivity) context).setFullscreen(true);
} }
((SlideMediaActivity) context).enableSliding(false); enableSliding(false);
} else { } else {
((SlideMediaActivity) context).enableSliding(true); enableSliding(true);
} }
}); });
ProgressBar pbar_inf = rootView.findViewById(R.id.pbar_inf); ProgressBar pbar_inf = rootView.findViewById(R.id.pbar_inf);
@ -171,6 +183,11 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
attachment.setType(type); attachment.setType(type);
} }
if (bgColor != -1) {
RelativeLayout media_fragment_container = rootView.findViewById(R.id.media_fragment_container);
media_fragment_container.setBackgroundColor(bgColor);
}
switch (type.toLowerCase()) { switch (type.toLowerCase()) {
case "image": case "image":
pbar_inf.setScaleY(1f); pbar_inf.setScaleY(1f);
@ -236,10 +253,20 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
} }
videoView.setVisibility(View.VISIBLE); videoView.setVisibility(View.VISIBLE);
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context,
Util.getUserAgent(context, "Fedilab"), null); String userAgent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
ExtractorMediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory) int video_cache = sharedpreferences.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
.createMediaSource(uri); ProgressiveMediaSource videoSource;
if (video_cache == 0) {
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context,
Util.getUserAgent(context, userAgent), null);
videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(uri);
} else {
CacheDataSourceFactory cacheDataSourceFactory = new CacheDataSourceFactory(context);
videoSource = new ProgressiveMediaSource.Factory(cacheDataSourceFactory)
.createMediaSource(uri);
}
player = ExoPlayerFactory.newSimpleInstance(context); player = ExoPlayerFactory.newSimpleInstance(context);
if (type.toLowerCase().equals("gifv")) if (type.toLowerCase().equals("gifv"))
player.setRepeatMode(Player.REPEAT_MODE_ONE); player.setRepeatMode(Player.REPEAT_MODE_ONE);
@ -278,10 +305,8 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
webview_video.setWebChromeClient(mastalabWebChromeClient); webview_video.setWebChromeClient(mastalabWebChromeClient);
webview_video.getSettings().setDomStorageEnabled(true); webview_video.getSettings().setDomStorageEnabled(true);
webview_video.getSettings().setAppCacheEnabled(true); webview_video.getSettings().setAppCacheEnabled(true);
String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, null); String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
if (user_agent != null) { webview_video.getSettings().setUserAgentString(user_agent);
webview_video.getSettings().setUserAgentString(user_agent);
}
webview_video.getSettings().setMediaPlaybackRequiresUserGesture(false); webview_video.getSettings().setMediaPlaybackRequiresUserGesture(false);
webview_video.setWebViewClient(new MastalabWebViewClient((Activity) context)); webview_video.setWebViewClient(new MastalabWebViewClient((Activity) context));
webview_video.loadUrl(attachment.getUrl()); webview_video.loadUrl(attachment.getUrl());
@ -453,6 +478,10 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (timer != null) {
timer.cancel();
timer = null;
}
super.onDestroy(); super.onDestroy();
} }
@ -475,8 +504,49 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
visualizerView.onResume(); visualizerView.onResume();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (slidrInterface == null && rootView != null) {
slidrInterface = Slidr.replace(rootView.findViewById(R.id.media_fragment_container), new SlidrConfig.Builder().sensitivity(1f)
.scrimColor(Color.BLACK)
.scrimStartAlpha(0.8f)
.scrimEndAlpha(0f)
.position(SlidrPosition.VERTICAL)
.velocityThreshold(2400)
.distanceThreshold(0.25f)
.edgeSize(0.18f)
.listener(new SlidrListener() {
@Override
public void onSlideStateChanged(int state) {
}
@Override
public void onSlideChange(float percent) {
((SlideMediaActivity) context).setFullscreen(true);
}
@Override
public void onSlideOpened() {
}
@Override
public boolean onSlideClosed() {
return false;
}
})
.build());
}
} }
private void enableSliding(boolean enable) {
if (enable && !swipeEnabled) {
slidrInterface.unlock();
swipeEnabled = true;
} else if (!enable && swipeEnabled) {
slidrInterface.lock();
swipeEnabled = false;
}
}
@Override @Override
public void onCompletion(MediaPlayer mp) { public void onCompletion(MediaPlayer mp) {

View File

@ -0,0 +1,56 @@
package app.fedilab.android.helper;
import android.content.Context;
import android.content.SharedPreferences;
import com.google.android.exoplayer2.database.ExoDatabaseProvider;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.google.android.exoplayer2.upstream.FileDataSource;
import com.google.android.exoplayer2.upstream.cache.CacheDataSink;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor;
import com.google.android.exoplayer2.upstream.cache.SimpleCache;
import java.io.File;
public class CacheDataSourceFactory implements DataSource.Factory {
private static SimpleCache sDownloadCache;
private final Context context;
private final DefaultDataSourceFactory defaultDatasourceFactory;
private final long maxFileSize;
public CacheDataSourceFactory(Context context) {
super();
this.context = context;
this.maxFileSize = 5 * 1024 * 1024;
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String userAgent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
DefaultBandwidthMeter.Builder bandwidthMeterBuilder = new DefaultBandwidthMeter.Builder(context);
DefaultBandwidthMeter bandwidthMeter = bandwidthMeterBuilder.build();
defaultDatasourceFactory = new DefaultDataSourceFactory(this.context,
bandwidthMeter,
new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter));
}
public static SimpleCache getInstance(Context context) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int video_cache = sharedpreferences.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor(video_cache * 1024 * 1024);
ExoDatabaseProvider exoDatabaseProvider = new ExoDatabaseProvider(context);
if (sDownloadCache == null)
sDownloadCache = new SimpleCache(new File(context.getCacheDir(), "media"), evictor, exoDatabaseProvider);
return sDownloadCache;
}
@Override
public DataSource createDataSource() {
SimpleCache simpleCache = getInstance(context);
return new CacheDataSource(simpleCache, defaultDatasourceFactory.createDataSource(),
new FileDataSource(), new CacheDataSink(simpleCache, maxFileSize),
CacheDataSource.FLAG_BLOCK_ON_CACHE | CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR, null);
}
}

View File

@ -320,6 +320,7 @@ public class Helper {
public static final int TOOTS_PER_PAGE = 40; public static final int TOOTS_PER_PAGE = 40;
public static final int ACCOUNTS_PER_PAGE = 40; public static final int ACCOUNTS_PER_PAGE = 40;
public static final int NOTIFICATIONS_PER_PAGE = 30; public static final int NOTIFICATIONS_PER_PAGE = 30;
public static final int DEFAULT_VIDEO_CACHE_MB = 100;
public static final String SET_ATTACHMENT_ACTION = "set_attachment_action"; public static final String SET_ATTACHMENT_ACTION = "set_attachment_action";
public static final String SET_TOOT_PER_PAGE = "set_toot_per_page"; public static final String SET_TOOT_PER_PAGE = "set_toot_per_page";
public static final String SET_THEME = "set_theme"; public static final String SET_THEME = "set_theme";
@ -435,6 +436,10 @@ public class Helper {
public static final String SET_NITTER_HOST = "set_nitter_host"; public static final String SET_NITTER_HOST = "set_nitter_host";
public static final String DEFAULT_NITTER_HOST = "nitter.net"; public static final String DEFAULT_NITTER_HOST = "nitter.net";
public static final String SET_BIBLIOGRAM = "set_bibliogram";
public static final String SET_BIBLIOGRAM_HOST = "set_bibliogram_host";
public static final String DEFAULT_BIBLIOGRAM_HOST = "bibliogram.art";
public static final String SET_NOTIF_VALIDATION = "set_share_validation"; public static final String SET_NOTIF_VALIDATION = "set_share_validation";
public static final String SET_NOTIF_VALIDATION_FAV = "set_share_validation_fav"; public static final String SET_NOTIF_VALIDATION_FAV = "set_share_validation_fav";
public static final String SET_WIFI_ONLY = "set_wifi_only"; public static final String SET_WIFI_ONLY = "set_wifi_only";
@ -462,6 +467,7 @@ public class Helper {
public static final String SET_SECURITY_PROVIDER = "set_security_provider"; public static final String SET_SECURITY_PROVIDER = "set_security_provider";
public static final String SET_ALLOW_STREAM = "set_allow_stream"; public static final String SET_ALLOW_STREAM = "set_allow_stream";
public static final String SET_CUSTOM_USER_AGENT = "set_custom_user_agent"; public static final String SET_CUSTOM_USER_AGENT = "set_custom_user_agent";
public static final String SET_VIDEO_CACHE = "set_video_cache";
//End points //End points
public static final String EP_AUTHORIZE = "/oauth/authorize"; public static final String EP_AUTHORIZE = "/oauth/authorize";
@ -512,6 +518,8 @@ public class Helper {
public static final Pattern twitterPattern = Pattern.compile("((@[\\w]+)@twitter\\.com)"); public static final Pattern twitterPattern = Pattern.compile("((@[\\w]+)@twitter\\.com)");
public static final Pattern youtubePattern = Pattern.compile("(www\\.|m\\.)?(youtube\\.com|youtu\\.be|youtube-nocookie\\.com)/(((?!([\"'<])).)*)"); public static final Pattern youtubePattern = Pattern.compile("(www\\.|m\\.)?(youtube\\.com|youtu\\.be|youtube-nocookie\\.com)/(((?!([\"'<])).)*)");
public static final Pattern nitterPattern = Pattern.compile("(mobile\\.|www\\.)?twitter.com([\\w-/]+)"); public static final Pattern nitterPattern = Pattern.compile("(mobile\\.|www\\.)?twitter.com([\\w-/]+)");
public static final Pattern bibliogramPattern = Pattern.compile("(m\\.|www\\.)?instagram.com(/p/[\\w-/]+)");
public static final Pattern ouichesPattern = Pattern.compile("https://ouich\\.es/tag/(\\w+)");
public static final Pattern xmppPattern = Pattern.compile("xmpp:[-a-zA-Z0-9+$&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); public static final Pattern xmppPattern = Pattern.compile("xmpp:[-a-zA-Z0-9+$&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
//Default values //Default values
public final static int DEFAULT_VIDEO_WIDTH = 640; public final static int DEFAULT_VIDEO_WIDTH = 640;
@ -1321,9 +1329,9 @@ public class Helper {
if (url.startsWith("/")) { if (url.startsWith("/")) {
url = "https://" + account.getInstance() + account.getAvatar(); url = "https://" + account.getInstance() + account.getAvatar();
} }
if( isValidContextForGlide(activity)) { if (isValidContextForGlide(activity)) {
if (!url.equals("null")) { if (!url.equals("null")) {
if( url.contains(".gif")) { if (url.contains(".gif")) {
Glide.with(navigationView.getContext()) Glide.with(navigationView.getContext())
.asGif() .asGif()
.load(url) .load(url)
@ -1339,7 +1347,7 @@ public class Helper {
} }
}); });
}else{ } else {
Glide.with(navigationView.getContext()) Glide.with(navigationView.getContext())
.asDrawable() .asDrawable()
.load(url) .load(url)
@ -1749,14 +1757,14 @@ public class Helper {
String avatarUrl = !disableGif ? accountChoice.getAvatar() : accountChoice.getAvatar_static(); String avatarUrl = !disableGif ? accountChoice.getAvatar() : accountChoice.getAvatar_static();
if( avatarUrl.contains(".gif")) { if (avatarUrl.contains(".gif")) {
Glide.with(finalIcon.getContext()) Glide.with(finalIcon.getContext())
.asGif() .asGif()
.load(avatarUrl) .load(avatarUrl)
.thumbnail(0.1f) .thumbnail(0.1f)
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270))) .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270)))
.into(finalIcon); .into(finalIcon);
}else{ } else {
Glide.with(activity) Glide.with(activity)
.asDrawable() .asDrawable()
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270))) .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270)))
@ -1819,17 +1827,17 @@ public class Helper {
if (!accountChoice.getAvatar().startsWith("http")) if (!accountChoice.getAvatar().startsWith("http"))
accountChoice.setAvatar("https://" + accountChoice.getInstance() + accountChoice.getAvatar()); accountChoice.setAvatar("https://" + accountChoice.getInstance() + accountChoice.getAvatar());
ImageView itemIconAcc = new ImageView(activity); ImageView itemIconAcc = new ImageView(activity);
if (isValidContextForGlide(activity) ) { if (isValidContextForGlide(activity)) {
try { try {
String avatarUrl = !disableGif ? accountChoice.getAvatar() : accountChoice.getAvatar_static(); String avatarUrl = !disableGif ? accountChoice.getAvatar() : accountChoice.getAvatar_static();
if( avatarUrl.contains(".gif")) { if (avatarUrl.contains(".gif")) {
Glide.with(itemIconAcc.getContext()) Glide.with(itemIconAcc.getContext())
.asGif() .asGif()
.load(avatarUrl) .load(avatarUrl)
.thumbnail(0.1f) .thumbnail(0.1f)
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270))) .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270)))
.into(itemIconAcc); .into(itemIconAcc);
}else{ } else {
Glide.with(activity) Glide.with(activity)
.asDrawable() .asDrawable()
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270))) .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270)))
@ -2262,10 +2270,8 @@ public class Helper {
webView.getSettings().setLoadsImagesAutomatically(true); webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setSupportMultipleWindows(false); webView.getSettings().setSupportMultipleWindows(false);
webView.getSettings().setMediaPlaybackRequiresUserGesture(true); webView.getSettings().setMediaPlaybackRequiresUserGesture(true);
String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, null); String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
if (user_agent != null) { webView.getSettings().setUserAgentString(user_agent);
webView.getSettings().setUserAgentString(user_agent);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
boolean cookies = sharedpreferences.getBoolean(Helper.SET_COOKIES, false); boolean cookies = sharedpreferences.getBoolean(Helper.SET_COOKIES, false);
CookieManager cookieManager = CookieManager.getInstance(); CookieManager cookieManager = CookieManager.getInstance();
@ -2993,7 +2999,7 @@ public class Helper {
} }
try { try {
assert url != null; assert url != null;
if (disableGif || (!url.endsWith(".gif") && account.getAvatar_static().compareTo(account.getAvatar()) == 0)) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE || disableGif || (!url.endsWith(".gif") && account.getAvatar_static().compareTo(account.getAvatar()) == 0)) {
Glide.with(imageView.getContext()) Glide.with(imageView.getContext())
.asDrawable() .asDrawable()
.load(url) .load(url)

View File

@ -1,21 +1,26 @@
package app.fedilab.android.helper; package app.fedilab.android.helper;
/* Copyright 2019 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.util.TypedValue; import android.util.TypedValue;
import static android.content.Context.MODE_PRIVATE;
public class ThemeHelper { public class ThemeHelper {
public static void changeTheme(Context context, int theme) {
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
}
public static int getAttColor(Context context, int attColor) { public static int getAttColor(Context context, int attColor) {
TypedValue typedValue = new TypedValue(); TypedValue typedValue = new TypedValue();
Resources.Theme theme = context.getTheme(); Resources.Theme theme = context.getTheme();

View File

@ -15,6 +15,8 @@ import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -31,7 +33,7 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
private List<Integer> colorPickerColors; private List<Integer> colorPickerColors;
private OnColorPickerClickListener onColorPickerClickListener; private OnColorPickerClickListener onColorPickerClickListener;
ColorPickerAdapter(@NonNull Context context, @NonNull List<Integer> colorPickerColors) { private ColorPickerAdapter(@NonNull Context context, @NonNull List<Integer> colorPickerColors) {
this.context = context; this.context = context;
this.inflater = LayoutInflater.from(context); this.inflater = LayoutInflater.from(context);
this.colorPickerColors = colorPickerColors; this.colorPickerColors = colorPickerColors;
@ -43,7 +45,7 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
this.inflater = LayoutInflater.from(context); this.inflater = LayoutInflater.from(context);
} }
public static List<Integer> getDefaultColors(Context context) { private static List<Integer> getDefaultColors(Context context) {
ArrayList<Integer> colorPickerColors = new ArrayList<>(); ArrayList<Integer> colorPickerColors = new ArrayList<>();
colorPickerColors.add(ContextCompat.getColor(context, R.color.blue_color_picker)); colorPickerColors.add(ContextCompat.getColor(context, R.color.blue_color_picker));
colorPickerColors.add(ContextCompat.getColor(context, R.color.brown_color_picker)); colorPickerColors.add(ContextCompat.getColor(context, R.color.brown_color_picker));
@ -60,8 +62,9 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
return colorPickerColors; return colorPickerColors;
} }
@NotNull
@Override @Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.color_picker_item_list, parent, false); View view = inflater.inflate(R.layout.color_picker_item_list, parent, false);
return new ViewHolder(view); return new ViewHolder(view);
} }
@ -98,7 +101,7 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
view.setBackgroundDrawable(layerDrawable); view.setBackgroundDrawable(layerDrawable);
} }
public void setOnColorPickerClickListener(OnColorPickerClickListener onColorPickerClickListener) { void setOnColorPickerClickListener(OnColorPickerClickListener onColorPickerClickListener) {
this.onColorPickerClickListener = onColorPickerClickListener; this.onColorPickerClickListener = onColorPickerClickListener;
} }
@ -109,15 +112,12 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
class ViewHolder extends RecyclerView.ViewHolder { class ViewHolder extends RecyclerView.ViewHolder {
View colorPickerView; View colorPickerView;
public ViewHolder(View itemView) { ViewHolder(View itemView) {
super(itemView); super(itemView);
colorPickerView = itemView.findViewById(R.id.color_picker_view); colorPickerView = itemView.findViewById(R.id.color_picker_view);
itemView.setOnClickListener(new View.OnClickListener() { itemView.setOnClickListener(v -> {
@Override if (onColorPickerClickListener != null)
public void onClick(View v) { onColorPickerClickListener.onColorPickerClickListener(colorPickerColors.get(getAdapterPosition()));
if (onColorPickerClickListener != null)
onColorPickerClickListener.onColorPickerClickListener(colorPickerColors.get(getAdapterPosition()));
}
}); });
} }
} }

View File

@ -18,6 +18,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import app.fedilab.android.R; import app.fedilab.android.R;
import ja.burhanrashid52.photoeditor.PhotoEditor; import ja.burhanrashid52.photoeditor.PhotoEditor;
@ -46,7 +47,7 @@ public class EmojiBSFragment extends BottomSheetDialogFragment {
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
@Override @Override
public void setupDialog(Dialog dialog, int style) { public void setupDialog(@NotNull Dialog dialog, int style) {
super.setupDialog(dialog, style); super.setupDialog(dialog, style);
View contentView = View.inflate(getContext(), R.layout.fragment_bottom_sticker_emoji_dialog, null); View contentView = View.inflate(getContext(), R.layout.fragment_bottom_sticker_emoji_dialog, null);
dialog.setContentView(contentView); dialog.setContentView(contentView);
@ -75,7 +76,7 @@ public class EmojiBSFragment extends BottomSheetDialogFragment {
public class EmojiAdapter extends RecyclerView.Adapter<EmojiAdapter.ViewHolder> { public class EmojiAdapter extends RecyclerView.Adapter<EmojiAdapter.ViewHolder> {
ArrayList<String> emojisList = PhotoEditor.getEmojis(getActivity()); ArrayList<String> emojisList = PhotoEditor.getEmojis(Objects.requireNonNull(getActivity()));
@NotNull @NotNull
@Override @Override
@ -101,14 +102,11 @@ public class EmojiBSFragment extends BottomSheetDialogFragment {
super(itemView); super(itemView);
txtEmoji = itemView.findViewById(R.id.txtEmoji); txtEmoji = itemView.findViewById(R.id.txtEmoji);
itemView.setOnClickListener(new View.OnClickListener() { itemView.setOnClickListener(v -> {
@Override if (mEmojiListener != null) {
public void onClick(View v) { mEmojiListener.onEmojiClick(emojisList.get(getLayoutPosition()));
if (mEmojiListener != null) {
mEmojiListener.onEmojiClick(emojisList.get(getLayoutPosition()));
}
dismiss();
} }
dismiss();
}); });
} }
} }

View File

@ -51,13 +51,10 @@ public class PropertiesBSFragment extends BottomSheetDialogFragment implements S
rvColor.setLayoutManager(layoutManager); rvColor.setLayoutManager(layoutManager);
rvColor.setHasFixedSize(true); rvColor.setHasFixedSize(true);
ColorPickerAdapter colorPickerAdapter = new ColorPickerAdapter(Objects.requireNonNull(getActivity())); ColorPickerAdapter colorPickerAdapter = new ColorPickerAdapter(Objects.requireNonNull(getActivity()));
colorPickerAdapter.setOnColorPickerClickListener(new ColorPickerAdapter.OnColorPickerClickListener() { colorPickerAdapter.setOnColorPickerClickListener(colorCode -> {
@Override if (mProperties != null) {
public void onColorPickerClickListener(int colorCode) { dismiss();
if (mProperties != null) { mProperties.onColorChanged(colorCode);
dismiss();
mProperties.onColorChanged(colorCode);
}
} }
}); });
rvColor.setAdapter(colorPickerAdapter); rvColor.setAdapter(colorPickerAdapter);

View File

@ -51,7 +51,7 @@ public class StickerBSFragment extends BottomSheetDialogFragment {
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
@Override @Override
public void setupDialog(Dialog dialog, int style) { public void setupDialog(@NotNull Dialog dialog, int style) {
super.setupDialog(dialog, style); super.setupDialog(dialog, style);
View contentView = View.inflate(getContext(), R.layout.fragment_bottom_sticker_emoji_dialog, null); View contentView = View.inflate(getContext(), R.layout.fragment_bottom_sticker_emoji_dialog, null);
dialog.setContentView(contentView); dialog.setContentView(contentView);
@ -76,6 +76,7 @@ public class StickerBSFragment extends BottomSheetDialogFragment {
} }
@SuppressWarnings("unused")
private String convertEmoji(String emoji) { private String convertEmoji(String emoji) {
String returnedEmoji = ""; String returnedEmoji = "";
try { try {
@ -137,16 +138,13 @@ public class StickerBSFragment extends BottomSheetDialogFragment {
super(itemView); super(itemView);
imgSticker = itemView.findViewById(R.id.imgSticker); imgSticker = itemView.findViewById(R.id.imgSticker);
itemView.setOnClickListener(new View.OnClickListener() { itemView.setOnClickListener(v -> {
@Override if (mStickerListener != null) {
public void onClick(View v) { mStickerListener.onStickerClick(
if (mStickerListener != null) { BitmapFactory.decodeResource(getResources(),
mStickerListener.onStickerClick( stickerList[getLayoutPosition()]));
BitmapFactory.decodeResource(getResources(),
stickerList[getLayoutPosition()]));
}
dismiss();
} }
dismiss();
}); });
} }
} }

View File

@ -32,10 +32,9 @@ import app.fedilab.android.R;
public class TextEditorDialogFragment extends DialogFragment { public class TextEditorDialogFragment extends DialogFragment {
public static final String TAG = TextEditorDialogFragment.class.getSimpleName(); public static final String TAG = TextEditorDialogFragment.class.getSimpleName();
public static final String EXTRA_INPUT_TEXT = "extra_input_text"; private static final String EXTRA_INPUT_TEXT = "extra_input_text";
public static final String EXTRA_COLOR_CODE = "extra_color_code"; private static final String EXTRA_COLOR_CODE = "extra_color_code";
private EditText mAddTextEditText; private EditText mAddTextEditText;
private TextView mAddTextDoneTextView;
private InputMethodManager mInputMethodManager; private InputMethodManager mInputMethodManager;
private int mColorCode; private int mColorCode;
private TextEditor mTextEditor; private TextEditor mTextEditor;
@ -64,7 +63,7 @@ public class TextEditorDialogFragment extends DialogFragment {
super.onStart(); super.onStart();
Dialog dialog = getDialog(); Dialog dialog = getDialog();
//Make dialog full screen with transparent background //Make dialog full screen with transparent background
if (dialog != null) { if (dialog != null && dialog.getWindow() != null) {
int width = ViewGroup.LayoutParams.MATCH_PARENT; int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT; int height = ViewGroup.LayoutParams.MATCH_PARENT;
dialog.getWindow().setLayout(width, height); dialog.getWindow().setLayout(width, height);
@ -82,41 +81,39 @@ public class TextEditorDialogFragment extends DialogFragment {
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
mAddTextEditText = view.findViewById(R.id.add_text_edit_text); mAddTextEditText = view.findViewById(R.id.add_text_edit_text);
mInputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); if (getActivity() != null) {
mAddTextDoneTextView = view.findViewById(R.id.add_text_done_tv); mInputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
TextView mAddTextDoneTextView = view.findViewById(R.id.add_text_done_tv);
//Setup the color picker for text color
RecyclerView addTextColorPickerRecyclerView = view.findViewById(R.id.add_text_color_picker_recycler_view); //Setup the color picker for text color
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); RecyclerView addTextColorPickerRecyclerView = view.findViewById(R.id.add_text_color_picker_recycler_view);
addTextColorPickerRecyclerView.setLayoutManager(layoutManager); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
addTextColorPickerRecyclerView.setHasFixedSize(true); addTextColorPickerRecyclerView.setLayoutManager(layoutManager);
ColorPickerAdapter colorPickerAdapter = new ColorPickerAdapter(getActivity()); addTextColorPickerRecyclerView.setHasFixedSize(true);
//This listener will change the text color when clicked on any color from picker ColorPickerAdapter colorPickerAdapter = new ColorPickerAdapter(getActivity());
colorPickerAdapter.setOnColorPickerClickListener(new ColorPickerAdapter.OnColorPickerClickListener() { //This listener will change the text color when clicked on any color from picker
@Override colorPickerAdapter.setOnColorPickerClickListener(colorCode -> {
public void onColorPickerClickListener(int colorCode) {
mColorCode = colorCode; mColorCode = colorCode;
mAddTextEditText.setTextColor(colorCode); mAddTextEditText.setTextColor(colorCode);
} });
}); addTextColorPickerRecyclerView.setAdapter(colorPickerAdapter);
addTextColorPickerRecyclerView.setAdapter(colorPickerAdapter); assert getArguments() != null;
mAddTextEditText.setText(getArguments().getString(EXTRA_INPUT_TEXT)); mAddTextEditText.setText(getArguments().getString(EXTRA_INPUT_TEXT));
mColorCode = getArguments().getInt(EXTRA_COLOR_CODE); mColorCode = getArguments().getInt(EXTRA_COLOR_CODE);
mAddTextEditText.setTextColor(mColorCode); mAddTextEditText.setTextColor(mColorCode);
mInputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); mInputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
//Make a callback on activity when user is done with text editing //Make a callback on activity when user is done with text editing
mAddTextDoneTextView.setOnClickListener(new View.OnClickListener() { mAddTextDoneTextView.setOnClickListener(view1 -> {
@Override mInputMethodManager.hideSoftInputFromWindow(view1.getWindowToken(), 0);
public void onClick(View view) {
mInputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
dismiss(); dismiss();
String inputText = mAddTextEditText.getText().toString(); String inputText = mAddTextEditText.getText().toString();
if (!TextUtils.isEmpty(inputText) && mTextEditor != null) { if (!TextUtils.isEmpty(inputText) && mTextEditor != null) {
mTextEditor.onDone(inputText, mColorCode); mTextEditor.onDone(inputText, mColorCode);
} }
} });
}); }
} }

View File

@ -59,7 +59,7 @@ public class EditingToolsAdapter extends RecyclerView.Adapter<EditingToolsAdapte
void onToolSelected(ToolType toolType); void onToolSelected(ToolType toolType);
} }
class ToolModel { static class ToolModel {
private String mToolName; private String mToolName;
private int mToolIcon; private int mToolIcon;
private ToolType mToolType; private ToolType mToolType;
@ -80,12 +80,7 @@ public class EditingToolsAdapter extends RecyclerView.Adapter<EditingToolsAdapte
super(itemView); super(itemView);
imgToolIcon = itemView.findViewById(R.id.imgToolIcon); imgToolIcon = itemView.findViewById(R.id.imgToolIcon);
txtTool = itemView.findViewById(R.id.txtTool); txtTool = itemView.findViewById(R.id.txtTool);
itemView.setOnClickListener(new View.OnClickListener() { itemView.setOnClickListener(v -> mOnItemSelected.onToolSelected(mToolList.get(getLayoutPosition()).mToolType));
@Override
public void onClick(View v) {
mOnItemSelected.onToolSelected(mToolList.get(getLayoutPosition()).mToolType);
}
});
} }
} }
} }

View File

@ -93,21 +93,15 @@ public class BackupNotificationInDataBaseService extends IntentService {
} }
boolean finalToastMessage = toastMessage; boolean finalToastMessage = toastMessage;
if (instanceRunning == 0) { if (instanceRunning == 0) {
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> {
@Override if (finalToastMessage) {
public void run() { Toasty.info(BackupNotificationInDataBaseService.this, getString(R.string.data_export_start), Toast.LENGTH_LONG).show();
if (finalToastMessage) {
Toasty.info(BackupNotificationInDataBaseService.this, getString(R.string.data_export_start), Toast.LENGTH_LONG).show();
}
} }
}); });
} else { } else {
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> {
@Override if (finalToastMessage) {
public void run() { Toasty.info(BackupNotificationInDataBaseService.this, getString(R.string.data_export_running), Toast.LENGTH_LONG).show();
if (finalToastMessage) {
Toasty.info(BackupNotificationInDataBaseService.this, getString(R.string.data_export_running), Toast.LENGTH_LONG).show();
}
} }
}); });
return; return;
@ -161,12 +155,9 @@ public class BackupNotificationInDataBaseService extends IntentService {
e.printStackTrace(); e.printStackTrace();
message = getString(R.string.data_export_error, account.getAcct()); message = getString(R.string.data_export_error, account.getAcct());
final String finalMessage = message; final String finalMessage = message;
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> {
@Override if (finalToastMessage) {
public void run() { Toasty.error(BackupNotificationInDataBaseService.this, finalMessage, Toast.LENGTH_LONG).show();
if (finalToastMessage) {
Toasty.error(BackupNotificationInDataBaseService.this, finalMessage, Toast.LENGTH_LONG).show();
}
} }
}); });
} }

View File

@ -94,21 +94,15 @@ public class BackupStatusInDataBaseService extends IntentService {
} }
boolean finalToastMessage = toastMessage; boolean finalToastMessage = toastMessage;
if (instanceRunning == 0) { if (instanceRunning == 0) {
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> {
@Override if (finalToastMessage) {
public void run() { Toasty.info(BackupStatusInDataBaseService.this, getString(R.string.data_export_start), Toast.LENGTH_LONG).show();
if (finalToastMessage) {
Toasty.info(BackupStatusInDataBaseService.this, getString(R.string.data_export_start), Toast.LENGTH_LONG).show();
}
} }
}); });
} else { } else {
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> {
@Override if (finalToastMessage) {
public void run() { Toasty.info(BackupStatusInDataBaseService.this, getString(R.string.data_export_running), Toast.LENGTH_LONG).show();
if (finalToastMessage) {
Toasty.info(BackupStatusInDataBaseService.this, getString(R.string.data_export_running), Toast.LENGTH_LONG).show();
}
} }
}); });
return; return;
@ -159,12 +153,9 @@ public class BackupStatusInDataBaseService extends IntentService {
e.printStackTrace(); e.printStackTrace();
message = getString(R.string.data_export_error, account.getAcct()); message = getString(R.string.data_export_error, account.getAcct());
final String finalMessage = message; final String finalMessage = message;
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> {
@Override if (finalToastMessage) {
public void run() { Toasty.error(BackupStatusInDataBaseService.this, finalMessage, Toast.LENGTH_LONG).show();
if (finalToastMessage) {
Toasty.error(BackupStatusInDataBaseService.this, finalMessage, Toast.LENGTH_LONG).show();
}
} }
}); });
} }

View File

@ -86,19 +86,9 @@ public class BackupStatusService extends IntentService {
@Override @Override
protected void onHandleIntent(@Nullable Intent intent) { protected void onHandleIntent(@Nullable Intent intent) {
if (instanceRunning == 0) { if (instanceRunning == 0) {
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> Toasty.info(BackupStatusService.this, getString(R.string.data_export_start), Toast.LENGTH_LONG).show());
@Override
public void run() {
Toasty.info(BackupStatusService.this, getString(R.string.data_export_start), Toast.LENGTH_LONG).show();
}
});
} else { } else {
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> Toasty.info(BackupStatusService.this, getString(R.string.data_export_running), Toast.LENGTH_LONG).show());
@Override
public void run() {
Toasty.info(BackupStatusService.this, getString(R.string.data_export_running), Toast.LENGTH_LONG).show();
}
});
return; return;
} }
instanceRunning++; instanceRunning++;
@ -164,7 +154,6 @@ public class BackupStatusService extends IntentService {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString(); content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
else else
//noinspection deprecation
content = Html.fromHtml(status.getContent()).toString(); content = Html.fromHtml(status.getContent()).toString();
builder.append("\"").append(content.replace("\"", "'").replace("\n", " ")).append("\"").append(','); builder.append("\"").append(content.replace("\"", "'").replace("\n", " ")).append("\"").append(',');
builder.append("\"").append(Helper.shortDateTime(BackupStatusService.this, status.getCreated_at())).append("\"").append(','); builder.append("\"").append(Helper.shortDateTime(BackupStatusService.this, status.getCreated_at())).append("\"").append(',');
@ -198,12 +187,7 @@ public class BackupStatusService extends IntentService {
e.printStackTrace(); e.printStackTrace();
message = getString(R.string.data_export_error, account.getAcct()); message = getString(R.string.data_export_error, account.getAcct());
final String finalMessage = message; final String finalMessage = message;
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(() -> Toasty.error(BackupStatusService.this, finalMessage, Toast.LENGTH_LONG).show());
@Override
public void run() {
Toasty.error(BackupStatusService.this, finalMessage, Toast.LENGTH_LONG).show();
}
});
} }
instanceRunning--; instanceRunning--;

View File

@ -126,7 +126,11 @@ public class LiveNotificationDelayedService extends Service {
.setContentTitle(getString(R.string.top_notification)) .setContentTitle(getString(R.string.top_notification))
.setSmallIcon(getNotificationIcon(LiveNotificationDelayedService.this)) .setSmallIcon(getNotificationIcon(LiveNotificationDelayedService.this))
.setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build(); .setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build();
startForeground(1, notification); if( notification != null) {
startForeground(1, notification);
}else{
return;
}
} }
@ -210,6 +214,7 @@ public class LiveNotificationDelayedService extends Service {
private void startThread(Account accountStream, String key) { private void startThread(Account accountStream, String key) {
Thread thread = new Thread() { Thread thread = new Thread() {
@SuppressWarnings("ConstantConditions")
@Override @Override
public void run() { public void run() {
while (fetch) { while (fetch) {
@ -236,6 +241,7 @@ public class LiveNotificationDelayedService extends Service {
} }
@SuppressWarnings("ConstantConditions")
private void taks(Account account) { private void taks(Account account) {
String key = account.getUsername() + "@" + account.getInstance(); String key = account.getUsername() + "@" + account.getInstance();
APIResponse apiResponse; APIResponse apiResponse;
@ -313,7 +319,11 @@ public class LiveNotificationDelayedService extends Service {
.setSmallIcon(getNotificationIcon(LiveNotificationDelayedService.this)) .setSmallIcon(getNotificationIcon(LiveNotificationDelayedService.this))
.setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build(); .setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build();
startForeground(1, notificationChannel); if( notificationChannel != null) {
startForeground(1, notificationChannel);
}else{
return;
}
} }
event = Helper.EventStreaming.NOTIFICATION; event = Helper.EventStreaming.NOTIFICATION;
@ -433,39 +443,36 @@ public class LiveNotificationDelayedService extends Service {
final String finalMessage = message; final String finalMessage = message;
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
Helper.NotifType finalNotifType = notifType; Helper.NotifType finalNotifType = notifType;
Runnable myRunnable = new Runnable() { Runnable myRunnable = () -> {
@Override if (finalMessage != null) {
public void run() { Glide.with(LiveNotificationDelayedService.this)
if (finalMessage != null) { .asBitmap()
Glide.with(LiveNotificationDelayedService.this) .load(notification.getAccount().getAvatar())
.asBitmap() .listener(new RequestListener<Bitmap>() {
.load(notification.getAccount().getAvatar()) @Override
.listener(new RequestListener<Bitmap>() { public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
@Override return false;
public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) { }
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) {
Helper.notify_user(LiveNotificationDelayedService.this, account, intent, BitmapFactory.decodeResource(getResources(), Helper.notify_user(LiveNotificationDelayedService.this, account, intent, BitmapFactory.decodeResource(getResources(),
getMainLogo(LiveNotificationDelayedService.this)), finalNotifType, "@" + notification.getAccount().getAcct(), finalMessage); getMainLogo(LiveNotificationDelayedService.this)), finalNotifType, "@" + notification.getAccount().getAcct(), finalMessage);
return false; return false;
} }
}) })
.into(new CustomTarget<Bitmap>() { .into(new CustomTarget<Bitmap>() {
@Override @Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) { public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
Helper.notify_user(LiveNotificationDelayedService.this, account, intent, resource, finalNotifType, "@" + notification.getAccount().getAcct(), finalMessage); Helper.notify_user(LiveNotificationDelayedService.this, account, intent, resource, finalNotifType, "@" + notification.getAccount().getAcct(), finalMessage);
} }
@Override @Override
public void onLoadCleared(@Nullable Drawable placeholder) { public void onLoadCleared(@Nullable Drawable placeholder) {
} }
}); });
}
} }
}; };
mainHandler.post(myRunnable); mainHandler.post(myRunnable);

View File

@ -140,7 +140,11 @@ public class LiveNotificationService extends Service implements NetworkStateRece
.setSmallIcon(getNotificationIcon(LiveNotificationService.this)) .setSmallIcon(getNotificationIcon(LiveNotificationService.this))
.setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build(); .setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build();
startForeground(1, notification); if( notification != null) {
startForeground(1, notification);
}else{
return;
}
} }
if (!notify) { if (!notify) {
stopSelf(); stopSelf();
@ -172,6 +176,8 @@ public class LiveNotificationService extends Service implements NetworkStateRece
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true); boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
if (!notify || intent == null || intent.getBooleanExtra("stop", false)) { if (!notify || intent == null || intent.getBooleanExtra("stop", false)) {
totalAccount = 0; totalAccount = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@ -197,7 +203,6 @@ public class LiveNotificationService extends Service implements NetworkStateRece
for (Thread t : Thread.getAllStackTraces().keySet()) { for (Thread t : Thread.getAllStackTraces().keySet()) {
if (t.getName().startsWith("notif_live_")) { if (t.getName().startsWith("notif_live_")) {
t.interrupt(); t.interrupt();
t = null;
} }
} }
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
@ -299,213 +304,205 @@ public class LiveNotificationService extends Service implements NetworkStateRece
if (response == null) if (response == null)
return; return;
final Notification notification; final Notification notification;
String dataId;
Bundle b = new Bundle(); Bundle b = new Bundle();
boolean canSendBroadCast = true; boolean canSendBroadCast = true;
Helper.EventStreaming event; Helper.EventStreaming event;
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
try { try {
switch (response.get("event").toString()) { if ("notification".equals(response.get("event").toString())) {
case "notification": eventsCount++;
eventsCount++; if (Build.VERSION.SDK_INT >= 26) {
if (Build.VERSION.SDK_INT >= 26) { channel = new NotificationChannel(CHANNEL_ID,
channel = new NotificationChannel(CHANNEL_ID, "Live notifications",
"Live notifications", NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager.IMPORTANCE_DEFAULT); ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); android.app.Notification notificationChannel = new NotificationCompat.Builder(this, CHANNEL_ID)
android.app.Notification notificationChannel = new NotificationCompat.Builder(this, CHANNEL_ID) .setContentTitle(getString(R.string.top_notification))
.setContentTitle(getString(R.string.top_notification)) .setSmallIcon(getNotificationIcon(LiveNotificationService.this))
.setSmallIcon(getNotificationIcon(LiveNotificationService.this)) .setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build();
.setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build(); if( notificationChannel != null) {
startForeground(1, notificationChannel); startForeground(1, notificationChannel);
}else{
return;
} }
}
event = Helper.EventStreaming.NOTIFICATION; event = Helper.EventStreaming.NOTIFICATION;
notification = API.parseNotificationResponse(LiveNotificationService.this, new JSONObject(response.get("payload").toString())); notification = API.parseNotificationResponse(LiveNotificationService.this, new JSONObject(response.get("payload").toString()));
b.putParcelable("data", notification); b.putParcelable("data", notification);
boolean liveNotifications = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true); boolean liveNotifications = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true);
boolean canNotify = Helper.canNotify(LiveNotificationService.this); boolean canNotify = Helper.canNotify(LiveNotificationService.this);
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true); boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
String targeted_account = null; String targeted_account = null;
Helper.NotifType notifType = Helper.NotifType.MENTION; Helper.NotifType notifType = Helper.NotifType.MENTION;
boolean activityRunning = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("isMainActivityRunning", false); boolean activityRunning = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("isMainActivityRunning", false);
String key = account.getAcct() + "@" + account.getInstance(); String key = account.getAcct() + "@" + account.getInstance();
if (lastNotification.containsKey(key) && notification.getId().compareTo(Objects.requireNonNull(lastNotification.get(key))) <= 0) { if (lastNotification.containsKey(key) && notification.getId().compareTo(Objects.requireNonNull(lastNotification.get(key))) <= 0) {
canNotify = false; canNotify = false;
} }
String lastNotif = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + account.getId() + account.getInstance(), null); String lastNotif = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + account.getId() + account.getInstance(), null);
if (notification.getId().compareTo(Objects.requireNonNull(lastNotif)) <= 0) { if (notification.getId().compareTo(Objects.requireNonNull(lastNotif)) <= 0) {
canNotify = false; canNotify = false;
} }
boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true);
if (!allowStream) { if (!allowStream) {
canNotify = false; canNotify = false;
} }
if ((userId == null || !userId.equals(account.getId()) || !activityRunning) && liveNotifications && canNotify && notify) { if ((userId == null || !userId.equals(account.getId()) || !activityRunning) && liveNotifications && canNotify && notify) {
lastNotification.put(key, notification.getId()); lastNotification.put(key, notification.getId());
boolean notif_follow = sharedpreferences.getBoolean(Helper.SET_NOTIF_FOLLOW, true); boolean notif_follow = sharedpreferences.getBoolean(Helper.SET_NOTIF_FOLLOW, true);
boolean notif_add = sharedpreferences.getBoolean(Helper.SET_NOTIF_ADD, true); boolean notif_add = sharedpreferences.getBoolean(Helper.SET_NOTIF_ADD, true);
boolean notif_mention = sharedpreferences.getBoolean(Helper.SET_NOTIF_MENTION, true); boolean notif_mention = sharedpreferences.getBoolean(Helper.SET_NOTIF_MENTION, true);
boolean notif_share = sharedpreferences.getBoolean(Helper.SET_NOTIF_SHARE, true); boolean notif_share = sharedpreferences.getBoolean(Helper.SET_NOTIF_SHARE, true);
boolean notif_poll = sharedpreferences.getBoolean(Helper.SET_NOTIF_POLL, true); boolean notif_poll = sharedpreferences.getBoolean(Helper.SET_NOTIF_POLL, true);
boolean somethingToPush = (notif_follow || notif_add || notif_mention || notif_share || notif_poll); boolean somethingToPush = (notif_follow || notif_add || notif_mention || notif_share || notif_poll);
String message = null; String message = null;
if (somethingToPush) { if (somethingToPush) {
switch (notification.getType()) { switch (notification.getType()) {
case "mention": case "mention":
notifType = Helper.NotifType.MENTION; notifType = Helper.NotifType.MENTION;
if (notif_mention) { if (notif_mention) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0) if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_mention)); message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_mention));
else else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_mention)); message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_mention));
if (notification.getStatus() != null) { if (notification.getStatus() != null) {
if (notification.getStatus().getSpoiler_text() != null && notification.getStatus().getSpoiler_text().length() > 0) { if (notification.getStatus().getSpoiler_text() != null && notification.getStatus().getSpoiler_text().length() > 0) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getSpoiler_text(), FROM_HTML_MODE_LEGACY)); message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getSpoiler_text(), FROM_HTML_MODE_LEGACY));
else else
message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getSpoiler_text())); message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getSpoiler_text()));
} else { } else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getContent(), FROM_HTML_MODE_LEGACY)); message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getContent(), FROM_HTML_MODE_LEGACY));
else else
message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getContent())); message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getContent()));
}
} }
} else {
canSendBroadCast = false;
} }
break; } else {
case "reblog": canSendBroadCast = false;
notifType = Helper.NotifType.BOOST;
if (notif_share) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_reblog));
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_reblog));
} else {
canSendBroadCast = false;
}
break;
case "favourite":
notifType = Helper.NotifType.FAV;
if (notif_add) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_favourite));
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_favourite));
} else {
canSendBroadCast = false;
}
break;
case "follow_request":
notifType = Helper.NotifType.FOLLLOW;
if (notif_follow) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_follow_request));
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_follow_request));
targeted_account = notification.getAccount().getId();
} else {
canSendBroadCast = false;
}
break;
case "follow":
notifType = Helper.NotifType.FOLLLOW;
if (notif_follow) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_follow));
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_follow));
targeted_account = notification.getAccount().getId();
} else {
canSendBroadCast = false;
}
break;
case "poll":
notifType = Helper.NotifType.POLL;
if (notif_poll) {
if (notification.getAccount().getId() != null && notification.getAccount().getId().equals(userId))
message = getString(R.string.notif_poll_self);
else
message = getString(R.string.notif_poll);
} else {
canSendBroadCast = false;
}
break;
default:
}
//Some others notification
final Intent intent = new Intent(LiveNotificationService.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Helper.INTENT_ACTION, Helper.NOTIFICATION_INTENT);
intent.putExtra(Helper.PREF_KEY_ID, account.getId());
intent.putExtra(Helper.PREF_INSTANCE, account.getInstance());
if (targeted_account != null) {
intent.putExtra(Helper.INTENT_TARGETED_ACCOUNT, targeted_account);
}
final String finalMessage = message;
Handler mainHandler = new Handler(Looper.getMainLooper());
Helper.NotifType finalNotifType = notifType;
Runnable myRunnable = () -> {
if (finalMessage != null) {
Glide.with(LiveNotificationService.this)
.asBitmap()
.load(notification.getAccount().getAvatar())
.listener(new RequestListener<Bitmap>() {
@Override
public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
return false;
}
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
assert e != null;
Helper.notify_user(LiveNotificationService.this, account, intent, BitmapFactory.decodeResource(getResources(),
getMainLogo(LiveNotificationService.this)), finalNotifType, "@" + notification.getAccount().getAcct(), finalMessage);
return false;
}
})
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
Helper.notify_user(LiveNotificationService.this, account, intent, resource, finalNotifType, "@" + notification.getAccount().getAcct(), finalMessage);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
} }
}; break;
mainHandler.post(myRunnable); case "reblog":
notifType = Helper.NotifType.BOOST;
if (notif_share) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_reblog));
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_reblog));
} else {
canSendBroadCast = false;
}
break;
case "favourite":
notifType = Helper.NotifType.FAV;
if (notif_add) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_favourite));
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_favourite));
} else {
canSendBroadCast = false;
}
break;
case "follow_request":
notifType = Helper.NotifType.FOLLLOW;
if (notif_follow) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_follow_request));
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_follow_request));
targeted_account = notification.getAccount().getId();
} else {
canSendBroadCast = false;
}
break;
case "follow":
notifType = Helper.NotifType.FOLLLOW;
if (notif_follow) {
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
message = String.format("%s %s", notification.getAccount().getDisplay_name(), getString(R.string.notif_follow));
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_follow));
targeted_account = notification.getAccount().getId();
} else {
canSendBroadCast = false;
}
break;
case "poll":
notifType = Helper.NotifType.POLL;
if (notif_poll) {
if (notification.getAccount().getId() != null && notification.getAccount().getId().equals(userId))
message = getString(R.string.notif_poll_self);
else
message = getString(R.string.notif_poll);
} else {
canSendBroadCast = false;
}
break;
default:
} }
} //Some others notification
final Intent intent = new Intent(LiveNotificationService.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Helper.INTENT_ACTION, Helper.NOTIFICATION_INTENT);
intent.putExtra(Helper.PREF_KEY_ID, account.getId());
intent.putExtra(Helper.PREF_INSTANCE, account.getInstance());
if (targeted_account != null) {
intent.putExtra(Helper.INTENT_TARGETED_ACCOUNT, targeted_account);
}
final String finalMessage = message;
Handler mainHandler = new Handler(Looper.getMainLooper());
Helper.NotifType finalNotifType = notifType;
Runnable myRunnable = () -> {
if (finalMessage != null) {
Glide.with(LiveNotificationService.this)
.asBitmap()
.load(notification.getAccount().getAvatar())
.listener(new RequestListener<Bitmap>() {
@Override
public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
return false;
}
if (canSendBroadCast) { @Override
b.putString("userIdService", account.getId()); public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
Intent intentBC = new Intent(Helper.RECEIVE_DATA); assert e != null;
intentBC.putExtra("eventStreaming", event); Helper.notify_user(LiveNotificationService.this, account, intent, BitmapFactory.decodeResource(getResources(),
intentBC.putExtras(b); getMainLogo(LiveNotificationService.this)), finalNotifType, "@" + notification.getAccount().getAcct(), finalMessage);
b.putParcelable("data", notification); return false;
LocalBroadcastManager.getInstance(LiveNotificationService.this).sendBroadcast(intentBC); }
SharedPreferences.Editor editor = sharedpreferences.edit(); })
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + account.getId() + account.getInstance(), notification.getId()); .into(new CustomTarget<Bitmap>() {
editor.apply(); @Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
Helper.notify_user(LiveNotificationService.this, account, intent, resource, finalNotifType, "@" + notification.getAccount().getAcct(), finalMessage);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
};
mainHandler.post(myRunnable);
} }
break; }
case "delete":
event = Helper.EventStreaming.DELETE; if (canSendBroadCast) {
try { b.putString("userIdService", account.getId());
dataId = response.getString("id"); Intent intentBC = new Intent(Helper.RECEIVE_DATA);
b.putString("dataId", dataId); intentBC.putExtra("eventStreaming", event);
} catch (JSONException ignored) { intentBC.putExtras(b);
} b.putParcelable("data", notification);
break; LocalBroadcastManager.getInstance(LiveNotificationService.this).sendBroadcast(intentBC);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + account.getId() + account.getInstance(), notification.getId());
editor.apply();
}
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} }
@ -521,7 +518,6 @@ public class LiveNotificationService extends Service implements NetworkStateRece
for (Thread t : Thread.getAllStackTraces().keySet()) { for (Thread t : Thread.getAllStackTraces().keySet()) {
if (t.getName().startsWith("notif_live_")) { if (t.getName().startsWith("notif_live_")) {
t.interrupt(); t.interrupt();
t = null;
} }
} }
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();

View File

@ -29,7 +29,6 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.koushikdutta.async.http.AsyncHttpClient; import com.koushikdutta.async.http.AsyncHttpClient;
import com.koushikdutta.async.http.AsyncHttpRequest; import com.koushikdutta.async.http.AsyncHttpRequest;
import com.koushikdutta.async.http.Headers; import com.koushikdutta.async.http.Headers;
import com.koushikdutta.async.http.WebSocket;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -37,8 +36,6 @@ import org.json.JSONObject;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import javax.net.ssl.HttpsURLConnection;
import app.fedilab.android.client.API; import app.fedilab.android.client.API;
import app.fedilab.android.client.Entities.Account; import app.fedilab.android.client.Entities.Account;
import app.fedilab.android.client.Entities.Status; import app.fedilab.android.client.Entities.Status;
@ -55,7 +52,6 @@ import app.fedilab.android.sqlite.Sqlite;
public class StreamingFederatedTimelineService extends IntentService { public class StreamingFederatedTimelineService extends IntentService {
private static HttpsURLConnection httpsURLConnection;
static { static {
Helper.installProvider(); Helper.installProvider();
@ -116,34 +112,27 @@ public class StreamingFederatedTimelineService extends IntentService {
try { try {
AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setSSLContext(new TLSSocketFactory(accountStream.getInstance()).getSSLContext()); AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setSSLContext(new TLSSocketFactory(accountStream.getInstance()).getSSLContext());
AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setConnectAllAddresses(true); AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setConnectAllAddresses(true);
} catch (KeyManagementException e) { } catch (KeyManagementException | NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
AsyncHttpClient.getDefaultInstance().websocket("wss://" + accountStream.getInstance() + "/api/v1/streaming/?stream=public&access_token=" + accountStream.getToken(), "wss", new AsyncHttpClient.WebSocketConnectCallback() { AsyncHttpClient.getDefaultInstance().websocket("wss://" + accountStream.getInstance() + "/api/v1/streaming/?stream=public&access_token=" + accountStream.getToken(), "wss", (ex, webSocket) -> {
@Override if (ex != null) {
public void onCompleted(Exception ex, WebSocket webSocket) { ex.printStackTrace();
if (ex != null) { return;
ex.printStackTrace(); }
webSocket.setStringCallback(s -> {
if (!sharedpreferences.getBoolean(Helper.SHOULD_CONTINUE_STREAMING_FEDERATED + finalAccountStream.getId() + finalAccountStream.getInstance(), true)) {
stopSelf();
return; return;
} }
webSocket.setStringCallback(new WebSocket.StringCallback() { try {
public void onStringAvailable(String s) { JSONObject eventJson = new JSONObject(s);
if (!sharedpreferences.getBoolean(Helper.SHOULD_CONTINUE_STREAMING_FEDERATED + finalAccountStream.getId() + finalAccountStream.getInstance(), true)) {
stopSelf();
return;
}
try {
JSONObject eventJson = new JSONObject(s);
onRetrieveStreaming(finalAccountStream, eventJson); onRetrieveStreaming(finalAccountStream, eventJson);
} catch (JSONException ignored) { } catch (JSONException ignored) {
} }
} });
});
}
}); });
} }
} }

View File

@ -29,7 +29,6 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.koushikdutta.async.http.AsyncHttpClient; import com.koushikdutta.async.http.AsyncHttpClient;
import com.koushikdutta.async.http.AsyncHttpRequest; import com.koushikdutta.async.http.AsyncHttpRequest;
import com.koushikdutta.async.http.Headers; import com.koushikdutta.async.http.Headers;
import com.koushikdutta.async.http.WebSocket;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -37,8 +36,6 @@ import org.json.JSONObject;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import javax.net.ssl.HttpsURLConnection;
import app.fedilab.android.client.API; import app.fedilab.android.client.API;
import app.fedilab.android.client.Entities.Account; import app.fedilab.android.client.Entities.Account;
import app.fedilab.android.client.Entities.Status; import app.fedilab.android.client.Entities.Status;
@ -55,7 +52,6 @@ import app.fedilab.android.sqlite.Sqlite;
public class StreamingHomeTimelineService extends IntentService { public class StreamingHomeTimelineService extends IntentService {
private static HttpsURLConnection httpsURLConnection;
static { static {
Helper.installProvider(); Helper.installProvider();
@ -116,34 +112,27 @@ public class StreamingHomeTimelineService extends IntentService {
try { try {
AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setSSLContext(new TLSSocketFactory(accountStream.getInstance()).getSSLContext()); AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setSSLContext(new TLSSocketFactory(accountStream.getInstance()).getSSLContext());
AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setConnectAllAddresses(true); AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setConnectAllAddresses(true);
} catch (KeyManagementException e) { } catch (KeyManagementException | NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
AsyncHttpClient.getDefaultInstance().websocket("wss://" + accountStream.getInstance() + "/api/v1/streaming/?stream=user&access_token=" + accountStream.getToken(), "wss", new AsyncHttpClient.WebSocketConnectCallback() { AsyncHttpClient.getDefaultInstance().websocket("wss://" + accountStream.getInstance() + "/api/v1/streaming/?stream=user&access_token=" + accountStream.getToken(), "wss", (ex, webSocket) -> {
@Override if (ex != null) {
public void onCompleted(Exception ex, WebSocket webSocket) { ex.printStackTrace();
if (ex != null) { return;
ex.printStackTrace(); }
webSocket.setStringCallback(s -> {
if (!sharedpreferences.getBoolean(Helper.SHOULD_CONTINUE_STREAMING_HOME + finalAccountStream.getId() + finalAccountStream.getInstance(), true)) {
stopSelf();
return; return;
} }
webSocket.setStringCallback(new WebSocket.StringCallback() { try {
public void onStringAvailable(String s) { JSONObject eventJson = new JSONObject(s);
if (!sharedpreferences.getBoolean(Helper.SHOULD_CONTINUE_STREAMING_HOME + finalAccountStream.getId() + finalAccountStream.getInstance(), true)) {
stopSelf();
return;
}
try {
JSONObject eventJson = new JSONObject(s);
onRetrieveStreaming(finalAccountStream, eventJson); onRetrieveStreaming(finalAccountStream, eventJson);
} catch (JSONException ignored) { } catch (JSONException ignored) {
} }
} });
});
}
}); });
} }
} }

View File

@ -29,7 +29,6 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.koushikdutta.async.http.AsyncHttpClient; import com.koushikdutta.async.http.AsyncHttpClient;
import com.koushikdutta.async.http.AsyncHttpRequest; import com.koushikdutta.async.http.AsyncHttpRequest;
import com.koushikdutta.async.http.Headers; import com.koushikdutta.async.http.Headers;
import com.koushikdutta.async.http.WebSocket;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -37,8 +36,6 @@ import org.json.JSONObject;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import javax.net.ssl.HttpsURLConnection;
import app.fedilab.android.client.API; import app.fedilab.android.client.API;
import app.fedilab.android.client.Entities.Account; import app.fedilab.android.client.Entities.Account;
import app.fedilab.android.client.Entities.Status; import app.fedilab.android.client.Entities.Status;
@ -55,7 +52,6 @@ import app.fedilab.android.sqlite.Sqlite;
public class StreamingLocalTimelineService extends IntentService { public class StreamingLocalTimelineService extends IntentService {
private static HttpsURLConnection httpsURLConnection;
static { static {
Helper.installProvider(); Helper.installProvider();
@ -117,33 +113,26 @@ public class StreamingLocalTimelineService extends IntentService {
try { try {
AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setSSLContext(new TLSSocketFactory(accountStream.getInstance()).getSSLContext()); AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setSSLContext(new TLSSocketFactory(accountStream.getInstance()).getSSLContext());
AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setConnectAllAddresses(true); AsyncHttpClient.getDefaultInstance().getSSLSocketMiddleware().setConnectAllAddresses(true);
} catch (KeyManagementException e) { } catch (KeyManagementException | NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
AsyncHttpClient.getDefaultInstance().websocket("wss://" + accountStream.getInstance() + "/api/v1/streaming/?stream=public:local&access_token=" + accountStream.getToken(), "wss", new AsyncHttpClient.WebSocketConnectCallback() { AsyncHttpClient.getDefaultInstance().websocket("wss://" + accountStream.getInstance() + "/api/v1/streaming/?stream=public:local&access_token=" + accountStream.getToken(), "wss", (ex, webSocket) -> {
@Override if (ex != null) {
public void onCompleted(Exception ex, WebSocket webSocket) { ex.printStackTrace();
if (ex != null) { return;
ex.printStackTrace(); }
webSocket.setStringCallback(s -> {
if (!sharedpreferences.getBoolean(Helper.SHOULD_CONTINUE_STREAMING_LOCAL + finalAccountStream.getId() + finalAccountStream.getInstance(), true)) {
stopSelf();
return; return;
} }
webSocket.setStringCallback(new WebSocket.StringCallback() { try {
public void onStringAvailable(String s) { JSONObject eventJson = new JSONObject(s);
if (!sharedpreferences.getBoolean(Helper.SHOULD_CONTINUE_STREAMING_LOCAL + finalAccountStream.getId() + finalAccountStream.getInstance(), true)) { onRetrieveStreaming(finalAccountStream, eventJson);
stopSelf(); } catch (JSONException ignored) {
return; }
} });
try {
JSONObject eventJson = new JSONObject(s);
onRetrieveStreaming(finalAccountStream, eventJson);
} catch (JSONException ignored) {
}
}
});
}
}); });
} }
} }

View File

@ -51,7 +51,8 @@ public class DomainBlockDAO {
values.put(Sqlite.COL_DOMAIN, domain); values.put(Sqlite.COL_DOMAIN, domain);
try { try {
db.insert(Sqlite.TABLE_TRACKING_BLOCK, null, values); db.insert(Sqlite.TABLE_TRACKING_BLOCK, null, values);
} catch (Exception ignored) {} } catch (Exception ignored) {
}
} }
/** /**

View File

@ -172,7 +172,7 @@
android:id="@+id/account_dn" android:id="@+id/account_dn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="?colorAccent" android:textColor="?colorAccent"
android:textSize="16sp" /> android:textSize="16sp" />
@ -181,7 +181,7 @@
android:id="@+id/account_un" android:id="@+id/account_un"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -268,7 +268,7 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:background="@drawable/blue_border" android:background="@drawable/blue_border"
android:maxLines="1" android:singleLine="true"
android:textColor="@color/mastodonC4" android:textColor="@color/mastodonC4"
android:visibility="gone" /> android:visibility="gone" />
@ -279,7 +279,7 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:background="@drawable/blue_border" android:background="@drawable/blue_border"
android:maxLines="1" android:singleLine="true"
android:visibility="gone" android:visibility="gone"
android:textColor="@color/mastodonC4" /> android:textColor="@color/mastodonC4" />
@ -290,7 +290,7 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:background="@drawable/green_border" android:background="@drawable/green_border"
android:maxLines="1" android:singleLine="true"
android:text="@string/followed_by" android:text="@string/followed_by"
android:textColor="@color/verified_text" android:textColor="@color/verified_text"
android:visibility="gone" /> android:visibility="gone" />
@ -302,7 +302,7 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:background="@drawable/blue_border" android:background="@drawable/blue_border"
android:maxLines="1" android:singleLine="true"
android:text="@string/request_sent" android:text="@string/request_sent"
android:textColor="@color/mastodonC4" android:textColor="@color/mastodonC4"
android:visibility="gone" /> android:visibility="gone" />
@ -521,7 +521,7 @@
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_weight="1" android:layout_weight="1"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
<ImageButton <ImageButton

View File

@ -49,7 +49,7 @@
android:id="@+id/account_dn" android:id="@+id/account_dn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" /> android:textSize="18sp" />
@ -57,7 +57,7 @@
android:id="@+id/account_un" android:id="@+id/account_un"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
@ -66,7 +66,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:maxLines="1" android:singleLine="true"
android:textSize="16sp" android:textSize="16sp"
android:visibility="gone" /> android:visibility="gone" />
@ -93,7 +93,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/toots" /> android:text="@string/toots" />
<TextView <TextView
@ -111,7 +111,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/following" /> android:text="@string/following" />
<TextView <TextView
@ -129,7 +129,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/followers" /> android:text="@string/followers" />
<TextView <TextView
@ -154,7 +154,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:maxLines="1" android:singleLine="true"
android:text="@string/request_sent" android:text="@string/request_sent"
android:textColor="?colorAccent" android:textColor="?colorAccent"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -344,9 +344,9 @@
android:id="@+id/comment" android:id="@+id/comment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:importantForAutofill="no"
android:minLines="3" android:minLines="3"
app:layout_constraintTop_toBottomOf="@id/comment_label" app:layout_constraintTop_toBottomOf="@id/comment_label" />
android:importantForAutofill="no" />
<TextView <TextView
android:id="@+id/lv_statuses_label" android:id="@+id/lv_statuses_label"

View File

@ -54,10 +54,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:hint="@string/title_hint_custom_sharing" android:hint="@string/title_hint_custom_sharing"
android:importantForAutofill="no"
android:lines="2" android:lines="2"
android:maxLines="2" android:maxLines="2"
android:minLines="1" android:minLines="1" />
android:importantForAutofill="no" />
<!-- Description --> <!-- Description -->

View File

@ -56,7 +56,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:inputType="textPersonName" android:inputType="textPersonName"
android:maxLines="1" /> android:singleLine="true" />
<Button <Button
android:id="@+id/set_change_profile_picture" android:id="@+id/set_change_profile_picture"
@ -133,16 +133,16 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:inputType="text" android:importantForAutofill="no"
android:importantForAutofill="no" /> android:inputType="text" />
<EditText <EditText
android:id="@+id/cf_val_1" android:id="@+id/cf_val_1"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="2" android:layout_weight="2"
android:inputType="text" android:importantForAutofill="no"
android:importantForAutofill="no" /> android:inputType="text" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View File

@ -37,8 +37,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorPrimary" android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways" />
/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<RelativeLayout <RelativeLayout
@ -58,7 +57,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="@null" android:divider="@null"
android:scrollbars="none"/> android:scrollbars="none" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<RelativeLayout <RelativeLayout

View File

@ -37,8 +37,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorPrimary" android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways" />
/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<RelativeLayout <RelativeLayout

View File

@ -86,7 +86,7 @@
android:contentDescription="@string/contact_instance_admin" android:contentDescription="@string/contact_instance_admin"
android:src="@drawable/ic_mail_outline" android:src="@drawable/ic_mail_outline"
app:backgroundTint="?colorAccent" app:backgroundTint="?colorAccent"
app:tint="?iconColorMenu"/> app:tint="?iconColorMenu" />
</LinearLayout> </LinearLayout>
<!-- Main Loader --> <!-- Main Loader -->
<RelativeLayout <RelativeLayout

View File

@ -29,10 +29,11 @@
android:visibility="gone"> android:visibility="gone">
<LinearLayout <LinearLayout
android:id="@+id/main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical">
android:id="@+id/main_container">
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -85,19 +86,20 @@
android:text="via instances.social" android:text="via instances.social"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
<TextView <TextView
android:layout_marginTop="50dp" android:id="@+id/no_instance"
android:layout_marginBottom="50dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:textSize="16sp"
android:id="@+id/no_instance"
android:visibility="gone"
android:autoLink="web"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="50dp"
android:layout_marginBottom="50dp"
android:autoLink="web"
android:gravity="center"
android:text="@string/no_instance_reccord" android:text="@string/no_instance_reccord"
/> android:textSize="16sp"
android:visibility="gone" />
<Button <Button
android:id="@+id/close" android:id="@+id/close"
style="@style/Base.Widget.AppCompat.Button.Colored" style="@style/Base.Widget.AppCompat.Button.Colored"

View File

@ -39,8 +39,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorPrimary" android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways" />
/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<RelativeLayout <RelativeLayout

View File

@ -60,7 +60,7 @@
android:hint="@string/instance_example" android:hint="@string/instance_example"
android:imeOptions="actionNext" android:imeOptions="actionNext"
android:inputType="textWebEmailAddress" android:inputType="textWebEmailAddress"
android:maxLines="1" /> android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
@ -91,11 +91,11 @@
android:drawableStart="@drawable/ic_check_circle" android:drawableStart="@drawable/ic_check_circle"
android:drawablePadding="10dp" android:drawablePadding="10dp"
android:gravity="center" android:gravity="center"
android:maxLines="1"
android:paddingStart="15dp" android:paddingStart="15dp"
android:paddingTop="12dp" android:paddingTop="12dp"
android:paddingEnd="20dp" android:paddingEnd="20dp"
android:paddingBottom="12dp" android:paddingBottom="12dp"
android:singleLine="true"
android:text="@string/connect_instance" android:text="@string/connect_instance"
android:textAllCaps="false" android:textAllCaps="false"
android:textSize="20sp" android:textSize="20sp"
@ -169,7 +169,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/username" android:hint="@string/username"
android:inputType="textEmailAddress" android:inputType="textEmailAddress"
android:maxLines="1" /> android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
@ -180,8 +180,8 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:passwordToggleEnabled="true" app:layout_constraintTop_toBottomOf="@id/login_uid_container"
app:layout_constraintTop_toBottomOf="@id/login_uid_container"> app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_passwd" android:id="@+id/login_passwd"
@ -189,7 +189,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/password" android:hint="@string/password"
android:inputType="textPassword" android:inputType="textPassword"
android:maxLines="1" /> android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
@ -213,11 +213,11 @@
android:drawableStart="@drawable/mastodon_icon" android:drawableStart="@drawable/mastodon_icon"
android:drawablePadding="10dp" android:drawablePadding="10dp"
android:gravity="center" android:gravity="center"
android:maxLines="1"
android:paddingStart="15dp" android:paddingStart="15dp"
android:paddingTop="12dp" android:paddingTop="12dp"
android:paddingEnd="20dp" android:paddingEnd="20dp"
android:paddingBottom="12dp" android:paddingBottom="12dp"
android:singleLine="true"
android:text="@string/login" android:text="@string/login"
android:textAllCaps="false" android:textAllCaps="false"
android:textSize="20sp" android:textSize="20sp"

View File

@ -38,8 +38,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorPrimary" android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways">
>
<ImageView <ImageView
android:id="@+id/iconbar" android:id="@+id/iconbar"
@ -128,8 +127,7 @@
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin_floating" android:layout_margin="@dimen/fab_margin_floating"
android:contentDescription="@string/toot_it" android:contentDescription="@string/toot_it"
android:src="@drawable/ic_edit" android:src="@drawable/ic_edit" />
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/delete_all" android:id="@+id/delete_all"
@ -139,8 +137,7 @@
android:layout_margin="@dimen/fab_margin_floating" android:layout_margin="@dimen/fab_margin_floating"
android:contentDescription="@string/delete_all" android:contentDescription="@string/delete_all"
android:src="@drawable/ic_delete_floating" android:src="@drawable/ic_delete_floating"
android:visibility="gone" android:visibility="gone" />
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_new" android:id="@+id/add_new"
@ -150,8 +147,7 @@
android:layout_margin="@dimen/fab_margin_floating" android:layout_margin="@dimen/fab_margin_floating"
android:contentDescription="@string/add_new" android:contentDescription="@string/add_new"
android:src="@drawable/ic_action_add_new" android:src="@drawable/ic_action_add_new"
android:visibility="gone" android:visibility="gone" />
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView <com.google.android.material.navigation.NavigationView
@ -159,10 +155,10 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:fitsSystemWindows="false"
app:itemTextColor="?attr/textColor"
android:background="@color/cyanea_primary_dark_reference" android:background="@color/cyanea_primary_dark_reference"
android:fitsSystemWindows="false"
app:headerLayout="@layout/nav_header_main" app:headerLayout="@layout/nav_header_main"
app:itemTextColor="?attr/textColor"
app:menu="@menu/activity_main_drawer" /> app:menu="@menu/activity_main_drawer" />
</androidx.drawerlayout.widget.DrawerLayout> </androidx.drawerlayout.widget.DrawerLayout>

View File

@ -26,7 +26,7 @@
android:drawableEnd="@drawable/ic_search" android:drawableEnd="@drawable/ic_search"
android:drawableRight="@drawable/ic_search" android:drawableRight="@drawable/ic_search"
android:inputType="text" android:inputType="text"
android:maxLines="1" /> android:singleLine="true" />
<RelativeLayout <RelativeLayout
android:id="@+id/loader" android:id="@+id/loader"

View File

@ -17,7 +17,8 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:animateLayoutChanges="true"> android:animateLayoutChanges="true"
android:background="@android:color/transparent">
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/media_viewpager" android:id="@+id/media_viewpager"

View File

@ -22,8 +22,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorPrimary" android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways" />
/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<RelativeLayout <RelativeLayout

View File

@ -22,8 +22,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorPrimary" android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways" />
/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<RelativeLayout <RelativeLayout

View File

@ -45,7 +45,7 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<com.google.android.exoplayer2.ui.SimpleExoPlayerView <com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/media_video" android:id="@+id/media_video"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -17,7 +17,6 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:TagsEditText="http://schemas.android.com/apk/res-auto" xmlns:TagsEditText="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -122,8 +121,7 @@
<Spinner <Spinner
android:id="@+id/set_upload_channel" android:id="@+id/set_upload_channel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
</LinearLayout> </LinearLayout>
@ -145,8 +143,7 @@
<Spinner <Spinner
android:id="@+id/set_upload_categories" android:id="@+id/set_upload_categories"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
</LinearLayout> </LinearLayout>
@ -168,8 +165,7 @@
<Spinner <Spinner
android:id="@+id/set_upload_licenses" android:id="@+id/set_upload_licenses"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
</LinearLayout> </LinearLayout>
@ -191,8 +187,7 @@
<Spinner <Spinner
android:id="@+id/set_upload_languages" android:id="@+id/set_upload_languages"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
</LinearLayout> </LinearLayout>
<!-- Videos Privacy --> <!-- Videos Privacy -->
@ -213,8 +208,7 @@
<Spinner <Spinner
android:id="@+id/set_upload_privacy" android:id="@+id/set_upload_privacy"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
</LinearLayout> </LinearLayout>

View File

@ -16,7 +16,6 @@
--> -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -92,8 +91,7 @@
android:id="@+id/set_upload_privacy" android:id="@+id/set_upload_privacy"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="16sp" android:textSize="16sp" />
/>
</LinearLayout> </LinearLayout>
@ -104,7 +102,7 @@
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:hint="@string/title_video_peertube" android:hint="@string/title_video_peertube"
android:inputType="text" android:inputType="text"
android:maxLines="1" /> android:singleLine="true" />
<!-- Videos upload submit --> <!-- Videos upload submit -->
<Button <Button

View File

@ -97,17 +97,19 @@
android:id="@+id/pixelfed_story" android:id="@+id/pixelfed_story"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/pixelfed_story"/> android:text="@string/pixelfed_story" />
<TextView <TextView
android:visibility="gone" android:id="@+id/indication_story"
android:layout_marginTop="10dp"
android:textColor="@color/green"
android:background="@drawable/green_border"
android:gravity="center"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/green_border"
android:gravity="center"
android:text="@string/story_indication" android:text="@string/story_indication"
android:id="@+id/indication_story"/> android:textColor="@color/green"
android:visibility="gone" />
<ScrollView <ScrollView
android:id="@+id/composer_container" android:id="@+id/composer_container"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -39,8 +39,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorPrimary" android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways" />
/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<RelativeLayout <RelativeLayout

View File

@ -15,7 +15,6 @@
see <http://www.gnu.org/licenses>. see <http://www.gnu.org/licenses>.
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin" android:layout_margin="@dimen/fab_margin"
@ -39,9 +38,8 @@
android:id="@+id/reg_category" android:id="@+id/reg_category"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_gravity="end" android:layout_gravity="end"
/> android:textSize="16sp" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/reg_category_view" android:id="@+id/reg_category_view"

View File

@ -28,7 +28,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="@null" android:divider="@null"
android:scrollbars="none"/> android:scrollbars="none" />
<RelativeLayout <RelativeLayout
android:id="@+id/no_result" android:id="@+id/no_result"

View File

@ -27,11 +27,11 @@
android:id="@+id/search_tabLayout" android:id="@+id/search_tabLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:tabTextAppearance="@style/TabLayoutStyle"
android:background="?colorPrimary" android:background="?colorPrimary"
app:tabGravity="fill" app:tabGravity="fill"
app:tabMode="fixed" app:tabMode="fixed"
app:tabSelectedTextColor="?colorAccent" /> app:tabSelectedTextColor="?colorAccent"
app:tabTextAppearance="@style/TabLayoutStyle" />
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/search_viewpager" android:id="@+id/search_viewpager"

View File

@ -179,7 +179,7 @@
android:id="@+id/account_dn" android:id="@+id/account_dn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="?colorAccent" android:textColor="?colorAccent"
android:textSize="18sp" /> android:textSize="18sp" />
@ -188,7 +188,7 @@
android:id="@+id/account_un" android:id="@+id/account_un"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textSize="16sp" /> android:textSize="16sp" />
<TextView <TextView
@ -249,13 +249,13 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<TextView <TextView
android:textIsSelectable="true"
android:id="@+id/account_note" android:id="@+id/account_note"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:gravity="center" android:gravity="center"
android:padding="10dp" /> android:padding="10dp"
android:textIsSelectable="true" />
<HorizontalScrollView <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -277,7 +277,7 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:background="@drawable/blue_border" android:background="@drawable/blue_border"
android:maxLines="1" android:singleLine="true"
android:textColor="@color/mastodonC4" android:textColor="@color/mastodonC4"
android:visibility="gone" /> android:visibility="gone" />
@ -288,9 +288,9 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:background="@drawable/blue_border" android:background="@drawable/blue_border"
android:maxLines="1" android:singleLine="true"
android:visibility="gone" android:textColor="@color/mastodonC4"
android:textColor="@color/mastodonC4" /> android:visibility="gone" />
<TextView <TextView
android:id="@+id/account_followed_by" android:id="@+id/account_followed_by"
@ -299,7 +299,7 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:background="@drawable/green_border" android:background="@drawable/green_border"
android:maxLines="1" android:singleLine="true"
android:text="@string/followed_by" android:text="@string/followed_by"
android:textColor="@color/verified_text" android:textColor="@color/verified_text"
android:visibility="gone" /> android:visibility="gone" />
@ -311,7 +311,7 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:background="@drawable/blue_border" android:background="@drawable/blue_border"
android:maxLines="1" android:singleLine="true"
android:text="@string/request_sent" android:text="@string/request_sent"
android:textColor="@color/mastodonC4" android:textColor="@color/mastodonC4"
android:visibility="gone" /> android:visibility="gone" />
@ -358,13 +358,13 @@
<TextView <TextView
android:id="@+id/value1" android:id="@+id/value1"
android:textIsSelectable="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:paddingTop="10dp" android:paddingTop="10dp"
android:paddingBottom="10dp" /> android:paddingBottom="10dp"
android:textIsSelectable="true" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -399,13 +399,13 @@
<TextView <TextView
android:id="@+id/value2" android:id="@+id/value2"
android:textIsSelectable="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:paddingTop="10dp" android:paddingTop="10dp"
android:paddingBottom="10dp" /> android:paddingBottom="10dp"
android:textIsSelectable="true" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -439,13 +439,13 @@
<TextView <TextView
android:id="@+id/value3" android:id="@+id/value3"
android:textIsSelectable="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:paddingTop="10dp" android:paddingTop="10dp"
android:paddingBottom="10dp" /> android:paddingBottom="10dp"
android:textIsSelectable="true" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -478,13 +478,13 @@
<TextView <TextView
android:id="@+id/value4" android:id="@+id/value4"
android:textIsSelectable="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:paddingTop="10dp" android:paddingTop="10dp"
android:paddingBottom="10dp" /> android:paddingBottom="10dp"
android:textIsSelectable="true" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -501,8 +501,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" android:minHeight="?attr/actionBarSize"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
app:theme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Light">
>
<LinearLayout <LinearLayout
android:id="@+id/toolbar_content" android:id="@+id/toolbar_content"
@ -528,7 +527,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_weight="1" android:layout_weight="1"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
<ImageView <ImageView

View File

@ -14,16 +14,16 @@
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>.
--> -->
<LinearLayout android:id="@+id/drawer_layout" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="@dimen/toot_padding" android:paddingLeft="@dimen/toot_padding"
android:paddingTop="@dimen/toot_padding" android:paddingTop="@dimen/toot_padding"
android:paddingRight="@dimen/toot_padding" android:paddingRight="@dimen/toot_padding"
android:paddingBottom="@dimen/toot_padding" android:paddingBottom="@dimen/toot_padding">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView <TextView
android:id="@+id/warning_message" android:id="@+id/warning_message"
@ -43,19 +43,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:maxHeight="80dp"
android:hint="@string/toot_cw_placeholder" android:hint="@string/toot_cw_placeholder"
android:maxHeight="80dp"
android:visibility="gone" /> android:visibility="gone" />
<ScrollView <ScrollView
android:id="@+id/composer_container" android:id="@+id/composer_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="0dp" android:layout_marginLeft="0dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_marginRight="0dp" android:layout_marginRight="0dp"
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
android:layout_weight="1"
android:fillViewport="true"> android:fillViewport="true">
<app.fedilab.android.helper.MastalabAutoCompleteTextView <app.fedilab.android.helper.MastalabAutoCompleteTextView
@ -84,11 +84,11 @@
android:id="@+id/wysiwyg_container" android:id="@+id/wysiwyg_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="0dp" android:layout_marginLeft="0dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_marginRight="0dp" android:layout_marginRight="0dp"
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
android:layout_weight="1"
android:fillViewport="true" android:fillViewport="true"
android:visibility="gone"> android:visibility="gone">

View File

@ -29,7 +29,7 @@
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="10dp" android:layout_height="10dp"
android:padding="1dp"/> android:padding="1dp" />
<FrameLayout <FrameLayout
android:id="@+id/webview_container" android:id="@+id/webview_container"

View File

@ -29,7 +29,7 @@
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="10dp" android:layout_height="10dp"
android:padding="2dp"/> android:padding="2dp" />
<app.fedilab.android.webview.CustomWebview <app.fedilab.android.webview.CustomWebview
android:id="@+id/webviewConnect" android:id="@+id/webviewConnect"

View File

@ -38,8 +38,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorPrimary" android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways" />
/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<RelativeLayout <RelativeLayout
@ -55,7 +54,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="@null" android:divider="@null"
android:scrollbars="none"/> android:scrollbars="none" />
<RelativeLayout <RelativeLayout
android:id="@+id/no_action" android:id="@+id/no_action"

View File

@ -26,5 +26,5 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textWebEmailAddress" android:inputType="textWebEmailAddress"
android:maxLines="1" /> android:singleLine="true" />
</LinearLayout> </LinearLayout>

View File

@ -41,7 +41,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="text" android:inputType="text"
android:maxLines="1" /> android:singleLine="true" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -10,5 +10,5 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/action_lists_title_placeholder" android:hint="@string/action_lists_title_placeholder"
android:inputType="text" android:inputType="text"
android:maxLines="1" /> android:singleLine="true" />
</LinearLayout> </LinearLayout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
@ -19,7 +18,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:inputType="text" android:inputType="text"
android:maxLines="1" /> android:singleLine="true" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -60,8 +59,7 @@
android:id="@+id/set_upload_channel" android:id="@+id/set_upload_channel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="14sp" android:textSize="14sp" />
/>
</LinearLayout> </LinearLayout>
<!-- Videos Privacy --> <!-- Videos Privacy -->
<LinearLayout <LinearLayout
@ -83,8 +81,7 @@
android:id="@+id/set_upload_privacy" android:id="@+id/set_upload_privacy"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="14sp" android:textSize="14sp" />
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -16,7 +16,7 @@
android:hint="@string/create_folder" android:hint="@string/create_folder"
android:imeOptions="actionDone" android:imeOptions="actionDone"
android:inputType="text" android:inputType="text"
android:maxLines="1" /> android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
</LinearLayout> </LinearLayout>

View File

@ -51,7 +51,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:gravity="center_horizontal|top" android:gravity="center_horizontal|top"
android:maxLines="1" android:singleLine="true"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
<!-- Description --> <!-- Description -->

View File

@ -2,9 +2,9 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android" <TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:singleLine="true"
android:textColor="@color/red_1" /> android:textColor="@color/red_1" />

View File

@ -47,7 +47,7 @@
android:id="@+id/account_dn" android:id="@+id/account_dn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" /> android:textSize="18sp" />
@ -55,7 +55,7 @@
android:id="@+id/account_un" android:id="@+id/account_un"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
@ -64,7 +64,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:maxLines="1" android:singleLine="true"
android:textSize="16sp" android:textSize="16sp"
android:visibility="gone" /> android:visibility="gone" />
@ -91,7 +91,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/toots" /> android:text="@string/toots" />
<TextView <TextView
@ -109,7 +109,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/following" /> android:text="@string/following" />
<TextView <TextView
@ -127,7 +127,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/followers" /> android:text="@string/followers" />
<TextView <TextView
@ -153,7 +153,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:maxLines="1" android:singleLine="true"
android:text="@string/request_sent" android:text="@string/request_sent"
android:textColor="?colorAccent" android:textColor="?colorAccent"
android:visibility="gone" /> android:visibility="gone" />
@ -175,8 +175,8 @@
android:scaleType="fitXY" android:scaleType="fitXY"
android:visibility="gone" android:visibility="gone"
app:backgroundTint="?colorAccent" app:backgroundTint="?colorAccent"
app:tint="?iconColorMenu" app:fabSize="mini"
app:fabSize="mini" /> app:tint="?iconColorMenu" />
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/account_mute_notification" android:id="@+id/account_mute_notification"
@ -189,8 +189,8 @@
android:scaleType="fitXY" android:scaleType="fitXY"
android:visibility="gone" android:visibility="gone"
app:backgroundTint="?colorAccent" app:backgroundTint="?colorAccent"
app:tint="?iconColorMenu" app:fabSize="mini"
app:fabSize="mini" /> app:tint="?iconColorMenu" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -46,7 +46,7 @@
android:id="@+id/account_dn" android:id="@+id/account_dn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" /> android:textSize="18sp" />
@ -54,7 +54,7 @@
android:id="@+id/account_un" android:id="@+id/account_un"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
@ -63,7 +63,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:maxLines="1" android:singleLine="true"
android:textSize="16sp" android:textSize="16sp"
android:visibility="gone" /> android:visibility="gone" />
@ -73,7 +73,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:maxLines="1" android:singleLine="true"
android:text="@string/request_sent" android:text="@string/request_sent"
android:textColor="?colorAccent" android:textColor="?colorAccent"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -37,7 +37,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:maxLines="1" android:singleLine="true"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/account_un" app:layout_constraintBottom_toTopOf="@id/account_un"
app:layout_constraintLeft_toRightOf="@id/account_pp" app:layout_constraintLeft_toRightOf="@id/account_pp"
@ -49,7 +49,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:maxLines="1" android:singleLine="true"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintBottom_toTopOf="@id/btn_top_barrier" app:layout_constraintBottom_toTopOf="@id/btn_top_barrier"
app:layout_constraintLeft_toRightOf="@id/account_pp" app:layout_constraintLeft_toRightOf="@id/account_pp"

View File

@ -44,7 +44,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -54,7 +54,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
<!-- Content description set programmatically --> <!-- Content description set programmatically -->
@ -67,6 +67,6 @@
android:gravity="center" android:gravity="center"
android:scaleType="fitXY" android:scaleType="fitXY"
app:backgroundTint="?colorAccent" app:backgroundTint="?colorAccent"
app:tint="?iconColorMenu" app:fabSize="mini"
app:fabSize="mini" /> app:tint="?iconColorMenu" />
</LinearLayout> </LinearLayout>

View File

@ -73,7 +73,7 @@
android:id="@+id/account_dn" android:id="@+id/account_dn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" /> android:textSize="18sp" />
@ -81,7 +81,7 @@
android:id="@+id/account_un" android:id="@+id/account_un"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
@ -90,7 +90,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:maxLines="1" android:singleLine="true"
android:textSize="16sp" android:textSize="16sp"
android:visibility="gone" /> android:visibility="gone" />
@ -110,7 +110,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/toots" /> android:text="@string/toots" />
<TextView <TextView
@ -128,7 +128,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/following" /> android:text="@string/following" />
<TextView <TextView
@ -146,7 +146,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:text="@string/followers" /> android:text="@string/followers" />
<TextView <TextView

View File

@ -44,6 +44,6 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:maxLines="1" /> android:singleLine="true" />
</LinearLayout> </LinearLayout>

View File

@ -36,7 +36,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:maxLines="1" /> android:singleLine="true" />
<TextView <TextView
android:id="@+id/account_dn" android:id="@+id/account_dn"
@ -45,5 +45,5 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:maxLines="1" /> android:singleLine="true" />
</LinearLayout> </LinearLayout>

View File

@ -65,6 +65,6 @@
android:src="@drawable/ic_user_plus" android:src="@drawable/ic_user_plus"
android:textAllCaps="false" android:textAllCaps="false"
app:backgroundTint="?colorAccent" app:backgroundTint="?colorAccent"
app:tint="?iconColorMenu" app:fabSize="mini"
app:fabSize="mini" /> app:tint="?iconColorMenu" />
</LinearLayout> </LinearLayout>

View File

@ -37,6 +37,5 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginLeft="10dp" android:singleLine="true" />
android:maxLines="1" />
</LinearLayout> </LinearLayout>

View File

@ -16,7 +16,6 @@
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
@ -43,19 +42,18 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_margin="5dp"
app:fabSize="mini"
app:backgroundTint="?colorAccent"
app:tint="?iconColorMenu"
android:src="@drawable/ic_edit" android:src="@drawable/ic_edit"
/> app:backgroundTint="?colorAccent"
app:fabSize="mini"
app:tint="?iconColorMenu" />
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/delete_filter" android:id="@+id/delete_filter"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_margin="5dp"
app:fabSize="mini"
android:src="@drawable/ic_delete" android:src="@drawable/ic_delete"
app:backgroundTint="?colorAccent" app:backgroundTint="?colorAccent"
app:fabSize="mini"
app:tint="?iconColorMenu" /> app:tint="?iconColorMenu" />
</LinearLayout> </LinearLayout>

View File

@ -65,10 +65,10 @@
android:id="@+id/proof_arrow" android:id="@+id/proof_arrow"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:contentDescription="@string/identity_proofs"
android:src="@drawable/ic_keyboard_arrow_right" android:src="@drawable/ic_keyboard_arrow_right"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent" />
android:contentDescription="@string/identity_proofs" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -129,13 +129,13 @@
android:drawableStart="@drawable/ic_remove_red_eye" android:drawableStart="@drawable/ic_remove_red_eye"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:gravity="center" android:gravity="center"
android:maxLines="1"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:paddingRight="10dp" android:paddingRight="10dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:singleLine="true"
android:text="@string/load_attachment_spoiler" android:text="@string/load_attachment_spoiler"
android:textAllCaps="false" /> android:textAllCaps="false" />
</LinearLayout> </LinearLayout>
@ -278,13 +278,13 @@
android:drawableStart="@drawable/ic_photo" android:drawableStart="@drawable/ic_photo"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:gravity="center" android:gravity="center"
android:maxLines="1"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:paddingRight="10dp" android:paddingRight="10dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:singleLine="true"
android:text="@string/load_attachment" android:text="@string/load_attachment"
android:textAllCaps="false" android:textAllCaps="false"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -41,9 +41,9 @@
android:id="@+id/peertube_video_image" android:id="@+id/peertube_video_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp" android:layout_height="200dp"
android:contentDescription="@string/image_preview"
android:gravity="center" android:gravity="center"
android:scaleType="centerCrop" android:scaleType="centerCrop" />
android:contentDescription="@string/image_preview"/>
<LinearLayout <LinearLayout
android:id="@+id/bottom_container" android:id="@+id/bottom_container"
@ -56,9 +56,9 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:contentDescription="@string/profile_picture"
android:gravity="center" android:gravity="center"
android:scaleType="fitCenter" android:scaleType="fitCenter" />
android:contentDescription="@string/profile_picture" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -96,15 +96,13 @@
android:id="@+id/peertube_views" android:id="@+id/peertube_views"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="5dp" />
/>
<TextView <TextView
android:id="@+id/peertube_date" android:id="@+id/peertube_date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="5dp" />
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -15,12 +15,12 @@
see <http://www.gnu.org/licenses>. see <http://www.gnu.org/licenses>.
--> -->
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pf_cardview" android:id="@+id/pf_cardview"
android:layout_marginBottom="20dp" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_marginBottom="20dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -30,35 +30,36 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="5dp"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:paddingBottom="10dp" android:orientation="horizontal"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="5dp"
android:paddingRight="10dp" android:paddingRight="10dp"
android:orientation="horizontal"> android:paddingBottom="10dp">
<ImageView <ImageView
android:id="@+id/pf_pp" android:id="@+id/pf_pp"
android:layout_gravity="center"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" /> android:layout_height="40dp"
android:layout_gravity="center" />
<TextView <TextView
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:id="@+id/pf_username" android:id="@+id/pf_username"
android:textSize="16sp"
android:textStyle="bold"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:textSize="16sp"
android:textStyle="bold"
tools:ignore="RtlHardcoded" /> tools:ignore="RtlHardcoded" />
</LinearLayout> </LinearLayout>
<com.smarteist.autoimageslider.SliderView <com.smarteist.autoimageslider.SliderView
android:id="@+id/imageSlider" android:id="@+id/imageSlider"
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="300dp" android:layout_height="300dp"
android:visibility="gone"
app:sliderAnimationDuration="1000" app:sliderAnimationDuration="1000"
app:sliderAutoCycleDirection="back_and_forth" app:sliderAutoCycleDirection="back_and_forth"
app:sliderAutoCycleEnabled="true" app:sliderAutoCycleEnabled="true"
@ -76,16 +77,17 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
>
<ImageView <ImageView
android:visibility="gone"
android:id="@+id/art_media" android:id="@+id/art_media"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:visibility="gone"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ImageView <ImageView
android:id="@+id/art_media_play" android:id="@+id/art_media_play"
android:layout_width="30dp" android:layout_width="30dp"
@ -99,12 +101,12 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:paddingBottom="5dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="5dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -112,20 +114,20 @@
android:orientation="horizontal"> android:orientation="horizontal">
<com.varunest.sparkbutton.SparkButton <com.varunest.sparkbutton.SparkButton
android:layout_marginStart="15dp"
android:id="@+id/pf_share" android:id="@+id/pf_share"
app:sparkbutton_activeImage="@drawable/ic_share_media"
app:sparkbutton_inActiveImage="@drawable/ic_share_media"
android:contentDescription="@string/share"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
app:sparkbutton_iconSize="30dp" /> android:layout_marginStart="15dp"
android:contentDescription="@string/share"
app:sparkbutton_activeImage="@drawable/ic_share_media"
app:sparkbutton_iconSize="30dp"
app:sparkbutton_inActiveImage="@drawable/ic_share_media" />
<TextView <TextView
android:layout_marginTop="5dp"
android:id="@+id/pf_date" android:id="@+id/pf_date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginTop="5dp" />
</LinearLayout> </LinearLayout>

View File

@ -19,32 +19,34 @@
android:id="@+id/reaction_container" android:id="@+id/reaction_container"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:paddingTop="2dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:paddingBottom="2dp">
<TextView <TextView
android:id="@+id/reaction_name" android:id="@+id/reaction_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:textSize="16sp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
/> android:textSize="16sp" />
<ImageView <ImageView
android:id="@+id/reaction_emoji"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:id="@+id/reaction_emoji"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<TextView <TextView
android:textSize="16sp" android:id="@+id/reaction_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/reaction_count"/> android:textSize="16sp" />
</LinearLayout> </LinearLayout>

View File

@ -47,7 +47,7 @@
android:id="@+id/account_dn" android:id="@+id/account_dn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" /> android:textSize="18sp" />
@ -56,7 +56,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:maxLines="1" android:singleLine="true"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -78,7 +78,7 @@
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:maxLines="1" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" /> android:textSize="18sp" />

View File

@ -96,7 +96,7 @@
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:singleLine="true"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/status_account_profile_boost_by" app:layout_constraintBottom_toBottomOf="@id/status_account_profile_boost_by"
app:layout_constraintEnd_toStartOf="@id/status_boosted_date" app:layout_constraintEnd_toStartOf="@id/status_boosted_date"
@ -260,11 +260,11 @@
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:contentDescription="@string/delete" android:contentDescription="@string/delete"
android:src="@drawable/ic_clear_toot" android:src="@drawable/ic_clear_toot"
app:tint="?attr/iconColor"
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toEndOf="@id/fedilab_features" app:layout_constraintEnd_toEndOf="@id/fedilab_features"
app:layout_constraintStart_toStartOf="@id/fedilab_features" app:layout_constraintStart_toStartOf="@id/fedilab_features"
app:layout_constraintTop_toBottomOf="@id/fedilab_features" /> app:layout_constraintTop_toBottomOf="@id/fedilab_features"
app:tint="?attr/iconColor" />
<TextView <TextView
android:id="@+id/status_account_displayname_owner" android:id="@+id/status_account_displayname_owner"
@ -273,7 +273,7 @@
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:drawablePadding="2dp" android:drawablePadding="2dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:singleLine="true"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/status_account_username" app:layout_constraintBottom_toTopOf="@id/status_account_username"
@ -290,11 +290,11 @@
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:contentDescription="@string/cached_status" android:contentDescription="@string/cached_status"
android:src="@drawable/ic_cached_black" android:src="@drawable/ic_cached_black"
app:tint="?attr/textColor"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/status_account_displayname_owner" app:layout_constraintBottom_toBottomOf="@id/status_account_displayname_owner"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/status_account_displayname_owner" /> app:layout_constraintTop_toTopOf="@id/status_account_displayname_owner"
app:tint="?attr/textColor" />
<TextView <TextView
android:id="@+id/status_account_username" android:id="@+id/status_account_username"
@ -302,7 +302,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:singleLine="true"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textSize="12sp" android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@id/barrier_account_info_bottom" app:layout_constraintBottom_toBottomOf="@id/barrier_account_info_bottom"
@ -315,7 +315,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:maxLines="1" android:singleLine="true"
android:textSize="12sp" android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@id/status_account_username" app:layout_constraintBottom_toBottomOf="@id/status_account_username"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -360,9 +360,9 @@
android:drawableStart="@drawable/ic_remove_red_eye" android:drawableStart="@drawable/ic_remove_red_eye"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:singleLine="true"
android:text="@string/load_attachment_spoiler" android:text="@string/load_attachment_spoiler"
android:textAllCaps="false" /> android:textAllCaps="false" />
</LinearLayout> </LinearLayout>
@ -387,13 +387,13 @@
android:drawableStart="@drawable/ic_more_toot_content" android:drawableStart="@drawable/ic_more_toot_content"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1"
android:paddingTop="2dp" android:paddingTop="2dp"
android:paddingBottom="2dp" android:paddingBottom="2dp"
android:singleLine="true"
android:text="@string/display_toot_truncate" android:text="@string/display_toot_truncate"
android:textAllCaps="false" android:textAllCaps="false"
app:tint="?attr/iconColor" android:visibility="gone"
android:visibility="gone" /> app:tint="?attr/iconColor" />
<TextView <TextView
android:id="@+id/status_toot_app" android:id="@+id/status_toot_app"
@ -403,7 +403,7 @@
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:gravity="end" android:gravity="end"
android:maxLines="1" android:singleLine="true"
android:textStyle="italic" android:textStyle="italic"
android:visibility="gone" /> android:visibility="gone" />
@ -503,7 +503,6 @@
android:id="@+id/status_cardview_title" android:id="@+id/status_cardview_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -521,7 +520,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:maxLines="1" android:singleLine="true"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -552,8 +551,7 @@
android:layout_height="30dp" android:layout_height="30dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:contentDescription="@string/videos" android:contentDescription="@string/videos"
android:src="@drawable/ic_play_arrow" android:src="@drawable/ic_play_arrow" />
/>
</RelativeLayout> </RelativeLayout>
@ -920,7 +918,6 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:visibility="gone"
android:id="@+id/status_reactions" android:id="@+id/status_reactions"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -928,14 +925,17 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/status_action_container" app:layout_constraintBottom_toTopOf="@+id/status_action_container"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/status_content_section" app:layout_constraintStart_toStartOf="@id/status_content_section"
app:layout_constraintTop_toBottomOf="@id/status_content_section"> app:layout_constraintTop_toBottomOf="@id/status_content_section">
<LinearLayout <LinearLayout
android:visibility="gone"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:visibility="gone">
<app.fedilab.android.helper.MastalabAutoCompleteTextView <app.fedilab.android.helper.MastalabAutoCompleteTextView
android:id="@+id/fake_edittext" android:id="@+id/fake_edittext"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -948,31 +948,32 @@
android:id="@+id/status_add_reaction" android:id="@+id/status_add_reaction"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:src="@drawable/ic_add"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
app:tint="?attr/iconColor" android:contentDescription="@string/add_reaction"
android:src="@drawable/ic_add"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/add_reaction" /> app:tint="?attr/iconColor" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/reactions_view" android:id="@+id/reactions_view"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"/> android:layout_weight="1" />
<ImageView <ImageView
android:id="@+id/status_add_custom_emoji" android:id="@+id/status_add_custom_emoji"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:src="@drawable/ic_insert_emoticon"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
app:tint="?attr/iconColor" android:contentDescription="@string/add_reaction"
android:src="@drawable/ic_insert_emoticon"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/add_reaction" /> app:tint="?attr/iconColor" />
</LinearLayout> </LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -991,10 +992,10 @@
android:layout_height="30dp" android:layout_height="30dp"
android:contentDescription="@string/reply" android:contentDescription="@string/reply"
android:src="@drawable/ic_reply" android:src="@drawable/ic_reply"
app:tint="?attr/iconColor"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/iconColor" />
<TextView <TextView
android:id="@+id/status_reply_count" android:id="@+id/status_reply_count"
@ -1054,20 +1055,20 @@
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:contentDescription="@string/pin_add" android:contentDescription="@string/pin_add"
android:src="@drawable/ic_pin_drop" android:src="@drawable/ic_pin_drop"
app:tint="?attr/iconColor"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/status_favorite_count" app:layout_constraintStart_toEndOf="@id/status_favorite_count"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/iconColor" />
<ImageView <ImageView
android:id="@+id/status_privacy" android:id="@+id/status_privacy"
android:layout_width="25dp" android:layout_width="25dp"
android:layout_height="25dp" android:layout_height="25dp"
android:layout_marginEnd="15dp" android:layout_marginEnd="15dp"
app:tint="?attr/iconColor"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/status_more" app:layout_constraintEnd_toStartOf="@id/status_more"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/iconColor" />
<ImageView <ImageView
android:id="@+id/status_more" android:id="@+id/status_more"
@ -1075,10 +1076,10 @@
android:layout_height="25dp" android:layout_height="25dp"
android:contentDescription="@string/display_toot_truncate" android:contentDescription="@string/display_toot_truncate"
android:src="@drawable/ic_more_horiz" android:src="@drawable/ic_more_horiz"
app:tint="?attr/iconColor"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/iconColor" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
@ -1100,7 +1101,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:gravity="center" android:gravity="center"
android:maxLines="1" android:singleLine="true"
android:text="@string/fetch_more_toots" android:text="@string/fetch_more_toots"
android:textAllCaps="false" android:textAllCaps="false"
android:textSize="16sp" android:textSize="16sp"

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