Clean some activities
This commit is contained in:
parent
0fc0b19e6f
commit
007d6b85fc
|
@ -130,4 +130,5 @@ dependencies {
|
||||||
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'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
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.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
@ -63,7 +62,6 @@ 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.ExtractorMediaSource;
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
|
||||||
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.PlaybackControlView;
|
||||||
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
|
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
|
||||||
|
@ -130,7 +128,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
private RelativeLayout loader;
|
private RelativeLayout loader;
|
||||||
private TextView peertube_view_count, peertube_playlist, peertube_bookmark, peertube_like_count, peertube_dislike_count, peertube_share, peertube_download, peertube_description, peertube_title;
|
private TextView peertube_view_count, peertube_playlist, peertube_bookmark, peertube_like_count, peertube_dislike_count, peertube_share, peertube_download, peertube_description, peertube_title;
|
||||||
private ScrollView peertube_information_container;
|
private ScrollView peertube_information_container;
|
||||||
private int stopPosition;
|
|
||||||
private Peertube peertube;
|
private Peertube peertube;
|
||||||
private TextView toolbar_title;
|
private TextView toolbar_title;
|
||||||
private SimpleExoPlayerView playerView;
|
private SimpleExoPlayerView playerView;
|
||||||
|
@ -139,7 +136,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
private Dialog fullScreenDialog;
|
private Dialog fullScreenDialog;
|
||||||
private AppCompatImageView fullScreenIcon;
|
private AppCompatImageView fullScreenIcon;
|
||||||
private TextView resolution;
|
private TextView resolution;
|
||||||
private DefaultTrackSelector trackSelector;
|
|
||||||
private int mode;
|
private int mode;
|
||||||
private LinearLayout write_comment_container;
|
private LinearLayout write_comment_container;
|
||||||
private ImageView send;
|
private ImageView send;
|
||||||
|
@ -150,8 +146,10 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
private List<Playlist> playlists;
|
private List<Playlist> playlists;
|
||||||
|
|
||||||
public static void hideKeyboard(Activity activity) {
|
public static void hideKeyboard(Activity activity) {
|
||||||
if (activity != null && activity.getWindow() != null && activity.getWindow().getDecorView() != null) {
|
if (activity != null && activity.getWindow() != null) {
|
||||||
|
activity.getWindow().getDecorView();
|
||||||
InputMethodManager imm = (InputMethodManager) activity.getSystemService(INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) activity.getSystemService(INPUT_METHOD_SERVICE);
|
||||||
|
assert imm != null;
|
||||||
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,16 +191,13 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
add_comment_write = findViewById(R.id.add_comment_write);
|
add_comment_write = findViewById(R.id.add_comment_write);
|
||||||
peertube_playlist = findViewById(R.id.peertube_playlist);
|
peertube_playlist = findViewById(R.id.peertube_playlist);
|
||||||
send = findViewById(R.id.send);
|
send = findViewById(R.id.send);
|
||||||
add_comment_read.setOnClickListener(new View.OnClickListener() {
|
add_comment_read.setOnClickListener(v -> {
|
||||||
@Override
|
add_comment_read.setVisibility(View.GONE);
|
||||||
public void onClick(View v) {
|
add_comment_write.setVisibility(View.VISIBLE);
|
||||||
add_comment_read.setVisibility(View.GONE);
|
send.setVisibility(View.VISIBLE);
|
||||||
add_comment_write.setVisibility(View.VISIBLE);
|
add_comment_write.requestFocus();
|
||||||
send.setVisibility(View.VISIBLE);
|
add_comment_write.setSelection(add_comment_write.getText().length());
|
||||||
add_comment_write.requestFocus();
|
|
||||||
add_comment_write.setSelection(add_comment_write.getText().length());
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Helper.changeDrawableColor(PeertubeActivity.this, send, R.color.cyanea_accent);
|
Helper.changeDrawableColor(PeertubeActivity.this, send, R.color.cyanea_accent);
|
||||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
||||||
|
@ -213,18 +208,15 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
peertube_bookmark.setVisibility(View.GONE);
|
peertube_bookmark.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
send.setOnClickListener(new View.OnClickListener() {
|
send.setOnClickListener(v -> {
|
||||||
@Override
|
String comment = add_comment_write.getText().toString();
|
||||||
public void onClick(View v) {
|
if (comment.trim().length() > 0) {
|
||||||
String comment = add_comment_write.getText().toString();
|
new PostActionAsyncTask(PeertubeActivity.this, API.StatusAction.PEERTUBECOMMENT, peertube.getId(), null, comment, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
if (comment.trim().length() > 0) {
|
add_comment_write.setText("");
|
||||||
new PostActionAsyncTask(PeertubeActivity.this, API.StatusAction.PEERTUBECOMMENT, peertube.getId(), null, comment, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
add_comment_read.setVisibility(View.VISIBLE);
|
||||||
add_comment_write.setText("");
|
add_comment_write.setVisibility(View.GONE);
|
||||||
add_comment_read.setVisibility(View.VISIBLE);
|
send.setVisibility(View.GONE);
|
||||||
add_comment_write.setVisibility(View.GONE);
|
add_comment_read.requestFocus();
|
||||||
send.setVisibility(View.GONE);
|
|
||||||
add_comment_read.requestFocus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -250,12 +242,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
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);
|
||||||
toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
toolbar_close.setOnClickListener(v -> finish());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,27 +258,24 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
final ViewGroup videoLayout = findViewById(R.id.videoLayout);
|
final ViewGroup videoLayout = findViewById(R.id.videoLayout);
|
||||||
|
|
||||||
MastalabWebChromeClient mastalabWebChromeClient = new MastalabWebChromeClient(PeertubeActivity.this, webview_video, webview_container, videoLayout);
|
MastalabWebChromeClient mastalabWebChromeClient = new MastalabWebChromeClient(PeertubeActivity.this, webview_video, webview_container, videoLayout);
|
||||||
mastalabWebChromeClient.setOnToggledFullscreen(new MastalabWebChromeClient.ToggledFullscreenCallback() {
|
mastalabWebChromeClient.setOnToggledFullscreen(fullscreen -> {
|
||||||
@Override
|
|
||||||
public void toggledFullscreen(boolean fullscreen) {
|
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
videoLayout.setVisibility(View.VISIBLE);
|
videoLayout.setVisibility(View.VISIBLE);
|
||||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||||
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
attrs.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
attrs.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||||
getWindow().setAttributes(attrs);
|
getWindow().setAttributes(attrs);
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
|
||||||
peertube_information_container.setVisibility(View.GONE);
|
peertube_information_container.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||||
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
attrs.flags &= ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
attrs.flags &= ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||||
getWindow().setAttributes(attrs);
|
getWindow().setAttributes(attrs);
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||||
videoLayout.setVisibility(View.GONE);
|
videoLayout.setVisibility(View.GONE);
|
||||||
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, null);
|
||||||
|
@ -443,22 +427,14 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
input.setLayoutParams(lp);
|
input.setLayoutParams(lp);
|
||||||
builderInner.setView(input);
|
builderInner.setView(input);
|
||||||
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) {
|
String comment = input.getText().toString();
|
||||||
|
if (comment.trim().length() > 0) {
|
||||||
|
new PostActionAsyncTask(PeertubeActivity.this, API.StatusAction.PEERTUBECOMMENT, peertube.getId(), null, comment, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builderInner.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
String comment = input.getText().toString();
|
|
||||||
if (comment.trim().length() > 0) {
|
|
||||||
new PostActionAsyncTask(PeertubeActivity.this, API.StatusAction.PEERTUBECOMMENT, peertube.getId(), null, comment, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builderInner.show();
|
builderInner.show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -496,54 +472,48 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
peertube_playlist.setOnClickListener(new View.OnClickListener() {
|
peertube_playlist.setOnClickListener(v -> {
|
||||||
@Override
|
if (playlists != null && peertube.getId() != null) {
|
||||||
public void onClick(View v) {
|
PopupMenu popup = new PopupMenu(PeertubeActivity.this, peertube_playlist);
|
||||||
if (playlists != null && peertube.getId() != null) {
|
|
||||||
PopupMenu popup = new PopupMenu(PeertubeActivity.this, peertube_playlist);
|
|
||||||
|
|
||||||
for (Playlist playlist : playlists) {
|
for (Playlist playlist : playlists) {
|
||||||
String title = null;
|
String title = null;
|
||||||
for (String id : playlistForVideo) {
|
for (String id : playlistForVideo) {
|
||||||
if (playlist.getId().equals(id)) {
|
if (playlist.getId().equals(id)) {
|
||||||
title = "✔ " + playlist.getDisplayName();
|
title = "✔ " + playlist.getDisplayName();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (title == null) {
|
}
|
||||||
title = playlist.getDisplayName();
|
if (title == null) {
|
||||||
}
|
title = playlist.getDisplayName();
|
||||||
MenuItem item = popup.getMenu().add(0, 0, Menu.NONE, title);
|
}
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
MenuItem item = popup.getMenu().add(0, 0, Menu.NONE, title);
|
||||||
|
item.setOnMenuItemClickListener(item1 -> {
|
||||||
|
item1.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||||
|
item1.setActionView(new View(PeertubeActivity.this));
|
||||||
|
item1.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemActionExpand(MenuItem item1) {
|
||||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
return false;
|
||||||
item.setActionView(new View(PeertubeActivity.this));
|
}
|
||||||
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
public boolean onMenuItemActionCollapse(MenuItem item1) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (playlistForVideo.contains(playlist.getId())) {
|
|
||||||
item.setTitle(playlist.getDisplayName());
|
|
||||||
new ManagePlaylistsAsyncTask(PeertubeActivity.this, ManagePlaylistsAsyncTask.action.DELETE_VIDEOS, playlist, peertube.getId(), null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
playlistForVideo.remove(playlist.getId());
|
|
||||||
} else {
|
|
||||||
item.setTitle("✔ " + playlist.getDisplayName());
|
|
||||||
new ManagePlaylistsAsyncTask(PeertubeActivity.this, ManagePlaylistsAsyncTask.action.ADD_VIDEOS, playlist, peertube.getId(), null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
playlistForVideo.add(playlist.getId());
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popup.show();
|
if (playlistForVideo.contains(playlist.getId())) {
|
||||||
}
|
item1.setTitle(playlist.getDisplayName());
|
||||||
|
new ManagePlaylistsAsyncTask(PeertubeActivity.this, ManagePlaylistsAsyncTask.action.DELETE_VIDEOS, playlist, peertube.getId(), null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
playlistForVideo.remove(playlist.getId());
|
||||||
|
} else {
|
||||||
|
item1.setTitle("✔ " + playlist.getDisplayName());
|
||||||
|
new ManagePlaylistsAsyncTask(PeertubeActivity.this, ManagePlaylistsAsyncTask.action.ADD_VIDEOS, playlist, peertube.getId(), null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
playlistForVideo.add(playlist.getId());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
popup.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -574,54 +544,40 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
initResolution();
|
initResolution();
|
||||||
|
|
||||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
||||||
peertube_like_count.setOnClickListener(new View.OnClickListener() {
|
peertube_like_count.setOnClickListener(v -> {
|
||||||
@Override
|
String newState = peertube.getMyRating().equals("like") ? "none" : "like";
|
||||||
public void onClick(View v) {
|
new PostActionAsyncTask(PeertubeActivity.this, API.StatusAction.RATEVIDEO, peertube.getId(), null, newState, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
String newState = peertube.getMyRating().equals("like") ? "none" : "like";
|
peertube.setMyRating(newState);
|
||||||
new PostActionAsyncTask(PeertubeActivity.this, API.StatusAction.RATEVIDEO, peertube.getId(), null, newState, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
changeColor();
|
||||||
peertube.setMyRating(newState);
|
|
||||||
changeColor();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
peertube_dislike_count.setOnClickListener(new View.OnClickListener() {
|
peertube_dislike_count.setOnClickListener(v -> {
|
||||||
@Override
|
String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike";
|
||||||
public void onClick(View v) {
|
new PostActionAsyncTask(PeertubeActivity.this, API.StatusAction.RATEVIDEO, peertube.getId(), null, newState, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike";
|
peertube.setMyRating(newState);
|
||||||
new PostActionAsyncTask(PeertubeActivity.this, API.StatusAction.RATEVIDEO, peertube.getId(), null, newState, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
changeColor();
|
||||||
peertube.setMyRating(newState);
|
|
||||||
changeColor();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
peertube_like_count.setOnClickListener(new View.OnClickListener() {
|
peertube_like_count.setOnClickListener(v -> {
|
||||||
@Override
|
String newState = peertube.getMyRating().equals("like") ? "none" : "like";
|
||||||
public void onClick(View v) {
|
Status status = new Status();
|
||||||
String newState = peertube.getMyRating().equals("like") ? "none" : "like";
|
status.setUri("https://" + peertube.getAccount().getHost() + "/videos/watch/" + peertube.getUuid());
|
||||||
Status status = new Status();
|
CrossActions.doCrossAction(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, status, null, API.StatusAction.FAVOURITE, null, PeertubeActivity.this, true);
|
||||||
status.setUri("https://" + peertube.getAccount().getHost() + "/videos/watch/" + peertube.getUuid());
|
peertube.setMyRating(newState);
|
||||||
CrossActions.doCrossAction(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, status, null, API.StatusAction.FAVOURITE, null, PeertubeActivity.this, true);
|
changeColor();
|
||||||
peertube.setMyRating(newState);
|
|
||||||
changeColor();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
peertube_dislike_count.setOnClickListener(new View.OnClickListener() {
|
peertube_dislike_count.setOnClickListener(v -> {
|
||||||
@Override
|
String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike";
|
||||||
public void onClick(View v) {
|
Status status = new Status();
|
||||||
String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike";
|
status.setUri("https://" + peertube.getAccount().getHost() + "/videos/watch/" + peertube.getUuid());
|
||||||
Status status = new Status();
|
CrossActions.doCrossAction(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, status, null, API.StatusAction.UNFAVOURITE, null, PeertubeActivity.this, true);
|
||||||
status.setUri("https://" + peertube.getAccount().getHost() + "/videos/watch/" + peertube.getUuid());
|
peertube.setMyRating(newState);
|
||||||
CrossActions.doCrossAction(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, status, null, API.StatusAction.UNFAVOURITE, null, PeertubeActivity.this, true);
|
changeColor();
|
||||||
peertube.setMyRating(newState);
|
|
||||||
changeColor();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpsURLConnection.setDefaultSSLSocketFactory(new TLSSocketFactory(instance));
|
HttpsURLConnection.setDefaultSSLSocketFactory(new TLSSocketFactory(instance));
|
||||||
} catch (KeyManagementException e) {
|
} catch (KeyManagementException | NoSuchAlgorithmException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,18 +598,15 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
peertube_download.setOnClickListener(new View.OnClickListener() {
|
peertube_download.setOnClickListener(v -> {
|
||||||
@Override
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
public void onClick(View v) {
|
if (ContextCompat.checkSelfPermission(PeertubeActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(PeertubeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
ActivityCompat.requestPermissions(PeertubeActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Helper.EXTERNAL_STORAGE_REQUEST_CODE);
|
||||||
if (ContextCompat.checkSelfPermission(PeertubeActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(PeertubeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
|
||||||
ActivityCompat.requestPermissions(PeertubeActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Helper.EXTERNAL_STORAGE_REQUEST_CODE);
|
|
||||||
} else {
|
|
||||||
Helper.manageDownloads(PeertubeActivity.this, peertube.getFileDownloadUrl(null, peertube.isStreamService()));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Helper.manageDownloads(PeertubeActivity.this, peertube.getFileDownloadUrl(null, peertube.isStreamService()));
|
Helper.manageDownloads(PeertubeActivity.this, peertube.getFileDownloadUrl(null, peertube.isStreamService()));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Helper.manageDownloads(PeertubeActivity.this, peertube.getFileDownloadUrl(null, peertube.isStreamService()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SQLiteDatabase db = Sqlite.getInstance(PeertubeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(PeertubeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
@ -667,52 +620,45 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
img = ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube);
|
img = ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube);
|
||||||
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds(null, img, null, null);
|
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds(null, img, null, null);
|
||||||
|
|
||||||
peertube_bookmark.setOnClickListener(new View.OnClickListener() {
|
peertube_bookmark.setOnClickListener(v -> {
|
||||||
@Override
|
List<Peertube> peertubes1 = new PeertubeFavoritesDAO(PeertubeActivity.this, db).getSinglePeertube(peertube);
|
||||||
public void onClick(View v) {
|
if (peertubes1 == null || peertubes1.size() == 0) {
|
||||||
List<Peertube> peertubes = new PeertubeFavoritesDAO(PeertubeActivity.this, db).getSinglePeertube(peertube);
|
new PeertubeFavoritesDAO(PeertubeActivity.this, db).insert(peertube);
|
||||||
if (peertubes == null || peertubes.size() == 0) {
|
Toasty.success(PeertubeActivity.this, getString(R.string.bookmark_add_peertube), Toast.LENGTH_SHORT).show();
|
||||||
new PeertubeFavoritesDAO(PeertubeActivity.this, db).insert(peertube);
|
} else {
|
||||||
Toasty.success(PeertubeActivity.this, getString(R.string.bookmark_add_peertube), Toast.LENGTH_SHORT).show();
|
new PeertubeFavoritesDAO(PeertubeActivity.this, db).remove(peertube);
|
||||||
} else {
|
Toasty.success(PeertubeActivity.this, getString(R.string.bookmark_remove_peertube), Toast.LENGTH_SHORT).show();
|
||||||
new PeertubeFavoritesDAO(PeertubeActivity.this, db).remove(peertube);
|
|
||||||
Toasty.success(PeertubeActivity.this, getString(R.string.bookmark_remove_peertube), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
if (peertubes != null && peertubes.size() > 0) //Was initially in cache
|
|
||||||
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds(null, ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube_border), null, null);
|
|
||||||
else
|
|
||||||
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds(null, ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube), null, null);
|
|
||||||
}
|
}
|
||||||
|
if (peertubes1 != null && peertubes1.size() > 0) //Was initially in cache
|
||||||
|
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds(null, ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube_border), null, null);
|
||||||
|
else
|
||||||
|
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds(null, ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube), null, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
peertube_share.setOnClickListener(new View.OnClickListener() {
|
peertube_share.setOnClickListener(v -> {
|
||||||
@Override
|
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||||
public void onClick(View v) {
|
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via));
|
||||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
String url;
|
||||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via));
|
|
||||||
String url;
|
|
||||||
|
|
||||||
url = "https://" + peertube.getInstance() + "/videos/watch/" + peertube.getUuid();
|
url = "https://" + peertube.getInstance() + "/videos/watch/" + peertube.getUuid();
|
||||||
boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true);
|
boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true);
|
||||||
String extra_text;
|
String extra_text;
|
||||||
if (share_details) {
|
if (share_details) {
|
||||||
extra_text = "@" + peertube.getAccount().getAcct();
|
extra_text = "@" + peertube.getAccount().getAcct();
|
||||||
extra_text += "\r\n\r\n" + peertube.getName();
|
extra_text += "\r\n\r\n" + peertube.getName();
|
||||||
extra_text += "\n\n" + Helper.shortnameToUnicode(":link:", true) + " " + url + "\r\n-\n";
|
extra_text += "\n\n" + Helper.shortnameToUnicode(":link:", true) + " " + url + "\r\n-\n";
|
||||||
final String contentToot;
|
final String contentToot;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
contentToot = Html.fromHtml(peertube.getDescription(), Html.FROM_HTML_MODE_LEGACY).toString();
|
contentToot = Html.fromHtml(peertube.getDescription(), Html.FROM_HTML_MODE_LEGACY).toString();
|
||||||
else
|
else
|
||||||
//noinspection deprecation
|
contentToot = Html.fromHtml(peertube.getDescription()).toString();
|
||||||
contentToot = Html.fromHtml(peertube.getDescription()).toString();
|
extra_text += contentToot;
|
||||||
extra_text += contentToot;
|
} else {
|
||||||
} else {
|
extra_text = url;
|
||||||
extra_text = url;
|
|
||||||
}
|
|
||||||
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
|
|
||||||
sendIntent.setType("text/plain");
|
|
||||||
startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with)));
|
|
||||||
}
|
}
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +677,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
change();
|
change();
|
||||||
} else {
|
} else {
|
||||||
final ViewGroup videoLayout = findViewById(R.id.videoLayout);
|
|
||||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
||||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
|
@ -822,44 +767,36 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this, style);
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this, style);
|
||||||
builderSingle.setTitle(R.string.pickup_resolution);
|
builderSingle.setTitle(R.string.pickup_resolution);
|
||||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(PeertubeActivity.this, android.R.layout.select_dialog_item);
|
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(PeertubeActivity.this, android.R.layout.select_dialog_item);
|
||||||
for (String resolution : peertube.getResolution())
|
for (String resolution : peertube.getResolution())
|
||||||
arrayAdapter.add(resolution + "p");
|
arrayAdapter.add(resolution + "p");
|
||||||
builderSingle.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
@Override
|
builderSingle.setAdapter(arrayAdapter, (dialog, which) -> {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
String res = Objects.requireNonNull(arrayAdapter.getItem(which)).substring(0, Objects.requireNonNull(arrayAdapter.getItem(which)).length() - 1);
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builderSingle.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
String res = arrayAdapter.getItem(which).substring(0, arrayAdapter.getItem(which).length() - 1);
|
|
||||||
|
|
||||||
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);
|
PlaybackControlView 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) {
|
||||||
if (player != null)
|
if (player != null)
|
||||||
player.release();
|
player.release();
|
||||||
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,
|
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(PeertubeActivity.this,
|
||||||
Util.getUserAgent(PeertubeActivity.this, "Mastalab"), null);
|
Util.getUserAgent(PeertubeActivity.this, "Mastalab"), null);
|
||||||
|
|
||||||
ExtractorMediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory)
|
ExtractorMediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory)
|
||||||
.createMediaSource(Uri.parse(peertube.getFileUrl(res, peertube.isStreamService())));
|
.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);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
builderSingle.show();
|
builderSingle.show();
|
||||||
}
|
}
|
||||||
|
@ -908,14 +845,11 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
PlaybackControlView controlView = playerView.findViewById(R.id.exo_controller);
|
PlaybackControlView 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(new View.OnClickListener() {
|
fullScreenButton.setOnClickListener(v -> {
|
||||||
@Override
|
if (!fullScreenMode)
|
||||||
public void onClick(View v) {
|
openFullscreenDialog();
|
||||||
if (!fullScreenMode)
|
else
|
||||||
openFullscreenDialog();
|
closeFullscreenDialog();
|
||||||
else
|
|
||||||
closeFullscreenDialog();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,12 +857,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
PlaybackControlView controlView = playerView.findViewById(R.id.exo_controller);
|
PlaybackControlView 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(new View.OnClickListener() {
|
resolution.setOnClickListener(v -> displayResolution());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
displayResolution();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ package app.fedilab.android.activities;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
@ -117,12 +116,7 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
||||||
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);
|
||||||
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
toolbar_close.setOnClickListener(v -> finish());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
toolbar_title.setText(R.string.update_video);
|
toolbar_title.setText(R.string.update_video);
|
||||||
}
|
}
|
||||||
setContentView(R.layout.activity_peertube_edit);
|
setContentView(R.layout.activity_peertube_edit);
|
||||||
|
@ -142,37 +136,26 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
||||||
set_upload_enable_comments = findViewById(R.id.set_upload_enable_comments);
|
set_upload_enable_comments = findViewById(R.id.set_upload_enable_comments);
|
||||||
|
|
||||||
|
|
||||||
set_upload_delete.setOnClickListener(new View.OnClickListener() {
|
set_upload_delete.setOnClickListener(v -> {
|
||||||
@Override
|
AlertDialog.Builder builderInner;
|
||||||
public void onClick(View v) {
|
SharedPreferences sharedpreferences1 = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
AlertDialog.Builder builderInner;
|
int theme1 = sharedpreferences1.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
int style;
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
if (theme1 == Helper.THEME_DARK) {
|
||||||
int style;
|
style = R.style.DialogDark;
|
||||||
if (theme == Helper.THEME_DARK) {
|
} else if (theme1 == Helper.THEME_BLACK) {
|
||||||
style = R.style.DialogDark;
|
style = R.style.DialogBlack;
|
||||||
} else if (theme == Helper.THEME_BLACK) {
|
} else {
|
||||||
style = R.style.DialogBlack;
|
style = R.style.Dialog;
|
||||||
} else {
|
|
||||||
style = R.style.Dialog;
|
|
||||||
}
|
|
||||||
builderInner = new AlertDialog.Builder(PeertubeEditUploadActivity.this, style);
|
|
||||||
builderInner.setMessage(getString(R.string.delete_video_confirmation));
|
|
||||||
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builderInner.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
new PostActionAsyncTask(PeertubeEditUploadActivity.this, API.StatusAction.PEERTUBEDELETEVIDEO, videoId, PeertubeEditUploadActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builderInner.show();
|
|
||||||
}
|
}
|
||||||
|
builderInner = new AlertDialog.Builder(PeertubeEditUploadActivity.this, style);
|
||||||
|
builderInner.setMessage(getString(R.string.delete_video_confirmation));
|
||||||
|
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||||
|
new PostActionAsyncTask(PeertubeEditUploadActivity.this, API.StatusAction.PEERTUBEDELETEVIDEO, videoId, PeertubeEditUploadActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
builderInner.show();
|
||||||
});
|
});
|
||||||
//Get params from the API
|
//Get params from the API
|
||||||
LinkedHashMap<Integer, String> categories = new LinkedHashMap<>(peertubeInformation.getCategories());
|
LinkedHashMap<Integer, String> categories = new LinkedHashMap<>(peertubeInformation.getCategories());
|
||||||
|
@ -359,9 +342,6 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
||||||
LinkedHashMap<Integer, String> licences = new LinkedHashMap<>(peertubeInformation.getLicences());
|
LinkedHashMap<Integer, String> licences = new LinkedHashMap<>(peertubeInformation.getLicences());
|
||||||
LinkedHashMap<Integer, String> privacies = new LinkedHashMap<>(peertubeInformation.getPrivacies());
|
LinkedHashMap<Integer, String> privacies = new LinkedHashMap<>(peertubeInformation.getPrivacies());
|
||||||
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
|
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
|
||||||
LinkedHashMap<String, String> translations = null;
|
|
||||||
if (peertubeInformation.getTranslations() != null)
|
|
||||||
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
|
||||||
|
|
||||||
|
|
||||||
int languagePosition = 0;
|
int languagePosition = 0;
|
||||||
|
@ -532,27 +512,24 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
set_upload_submit.setOnClickListener(new View.OnClickListener() {
|
set_upload_submit.setOnClickListener(v -> {
|
||||||
@Override
|
String title1 = p_video_title.getText().toString().trim();
|
||||||
public void onClick(View v) {
|
String description = p_video_description.getText().toString().trim();
|
||||||
String title = p_video_title.getText().toString().trim();
|
boolean isNSFW1 = set_upload_nsfw.isChecked();
|
||||||
String description = p_video_description.getText().toString().trim();
|
boolean commentEnabled1 = set_upload_enable_comments.isChecked();
|
||||||
boolean isNSFW = set_upload_nsfw.isChecked();
|
peertube.setName(title1);
|
||||||
boolean commentEnabled = set_upload_enable_comments.isChecked();
|
peertube.setDescription(description);
|
||||||
peertube.setName(title);
|
peertube.setSensitive(isNSFW1);
|
||||||
peertube.setDescription(description);
|
peertube.setCommentsEnabled(commentEnabled1);
|
||||||
peertube.setSensitive(isNSFW);
|
peertube.setCategory(categoryToSend);
|
||||||
peertube.setCommentsEnabled(commentEnabled);
|
peertube.setLicense(licenseToSend);
|
||||||
peertube.setCategory(categoryToSend);
|
peertube.setLanguage(languageToSend);
|
||||||
peertube.setLicense(licenseToSend);
|
peertube.setChannelForUpdate(channelToSend);
|
||||||
peertube.setLanguage(languageToSend);
|
peertube.setPrivacy(privacyToSend);
|
||||||
peertube.setChannelForUpdate(channelToSend);
|
List<String> tags = p_video_tags.getTags();
|
||||||
peertube.setPrivacy(privacyToSend);
|
peertube.setTags(tags);
|
||||||
List<String> tags = p_video_tags.getTags();
|
set_upload_submit.setEnabled(false);
|
||||||
peertube.setTags(tags);
|
new PostPeertubeAsyncTask(PeertubeEditUploadActivity.this, peertube, PeertubeEditUploadActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||||
set_upload_submit.setEnabled(false);
|
|
||||||
new PostPeertubeAsyncTask(PeertubeEditUploadActivity.this, peertube, PeertubeEditUploadActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
set_upload_privacy.setSelection(privacyPosition);
|
set_upload_privacy.setSelection(privacyPosition);
|
||||||
|
|
|
@ -119,12 +119,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
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);
|
||||||
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
toolbar_close.setOnClickListener(v -> finish());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
toolbar_title.setText(R.string.upload_video);
|
toolbar_title.setText(R.string.upload_video);
|
||||||
}
|
}
|
||||||
setContentView(R.layout.activity_peertube_upload);
|
setContentView(R.layout.activity_peertube_upload);
|
||||||
|
@ -335,52 +330,49 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
set_upload_submit.setOnClickListener(new View.OnClickListener() {
|
set_upload_submit.setOnClickListener(v -> {
|
||||||
@Override
|
if (uri != null) {
|
||||||
public void onClick(View v) {
|
Map.Entry<String, String> channelM = channelToSend.entrySet().iterator().next();
|
||||||
if (uri != null) {
|
String idChannel = channelM.getValue();
|
||||||
Map.Entry<String, String> channelM = channelToSend.entrySet().iterator().next();
|
Map.Entry<Integer, String> privacyM = privacyToSend.entrySet().iterator().next();
|
||||||
String idChannel = channelM.getValue();
|
Integer idPrivacy = privacyM.getKey();
|
||||||
Map.Entry<Integer, String> privacyM = privacyToSend.entrySet().iterator().next();
|
|
||||||
Integer idPrivacy = privacyM.getKey();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||||
UploadNotificationConfig uploadConfig = new UploadNotificationConfig();
|
UploadNotificationConfig uploadConfig = new UploadNotificationConfig();
|
||||||
Intent in = new Intent(PeertubeUploadActivity.this, PeertubeEditUploadActivity.class);
|
Intent in = new Intent(PeertubeUploadActivity.this, PeertubeEditUploadActivity.class);
|
||||||
PendingIntent clickIntent = PendingIntent.getActivity(PeertubeUploadActivity.this, 1, in, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent clickIntent = PendingIntent.getActivity(PeertubeUploadActivity.this, 1, in, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
uploadConfig
|
uploadConfig
|
||||||
.setClearOnActionForAllStatuses(true);
|
.setClearOnActionForAllStatuses(true);
|
||||||
|
|
||||||
|
|
||||||
uploadConfig.getProgress().message = getString(R.string.uploading);
|
uploadConfig.getProgress().message = getString(R.string.uploading);
|
||||||
uploadConfig.getCompleted().message = getString(R.string.upload_video_success);
|
uploadConfig.getCompleted().message = getString(R.string.upload_video_success);
|
||||||
uploadConfig.getError().message = getString(R.string.toast_error);
|
uploadConfig.getError().message = getString(R.string.toast_error);
|
||||||
uploadConfig.getCancelled().message = getString(R.string.toast_cancelled);
|
uploadConfig.getCancelled().message = getString(R.string.toast_cancelled);
|
||||||
uploadConfig.getCompleted().actions.add(new UploadNotificationAction(R.drawable.ic_check, getString(R.string.video_uploaded_action), clickIntent));
|
uploadConfig.getCompleted().actions.add(new UploadNotificationAction(R.drawable.ic_check, getString(R.string.video_uploaded_action), clickIntent));
|
||||||
|
|
||||||
if (video_title != null && video_title.getText() != null && video_title.getText().toString().trim().length() > 0) {
|
if (video_title != null && video_title.getText() != null && video_title.getText().toString().trim().length() > 0) {
|
||||||
filename = video_title.getText().toString().trim();
|
filename = video_title.getText().toString().trim();
|
||||||
}
|
|
||||||
String uploadId = UUID.randomUUID().toString();
|
|
||||||
uploadReceiver.setUploadID(uploadId);
|
|
||||||
new MultipartUploadRequest(PeertubeUploadActivity.this, uploadId, "https://" + Helper.getLiveInstance(PeertubeUploadActivity.this) + "/api/v1/videos/upload")
|
|
||||||
.addFileToUpload(uri.toString().replace("file://", ""), "videofile")
|
|
||||||
.addHeader("Authorization", "Bearer " + token)
|
|
||||||
.setNotificationConfig(uploadConfig)
|
|
||||||
.addParameter("name", filename)
|
|
||||||
.addParameter("channelId", idChannel)
|
|
||||||
.addParameter("privacy", String.valueOf(idPrivacy))
|
|
||||||
.addParameter("nsfw", "false")
|
|
||||||
.addParameter("commentsEnabled", "true")
|
|
||||||
.addParameter("waitTranscoding", "true")
|
|
||||||
.setMaxRetries(2)
|
|
||||||
.startUpload();
|
|
||||||
finish();
|
|
||||||
} catch (Exception exc) {
|
|
||||||
exc.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
String uploadId = UUID.randomUUID().toString();
|
||||||
|
uploadReceiver.setUploadID(uploadId);
|
||||||
|
new MultipartUploadRequest(PeertubeUploadActivity.this, uploadId, "https://" + Helper.getLiveInstance(PeertubeUploadActivity.this) + "/api/v1/videos/upload")
|
||||||
|
.addFileToUpload(uri.toString().replace("file://", ""), "videofile")
|
||||||
|
.addHeader("Authorization", "Bearer " + token)
|
||||||
|
.setNotificationConfig(uploadConfig)
|
||||||
|
.addParameter("name", filename)
|
||||||
|
.addParameter("channelId", idChannel)
|
||||||
|
.addParameter("privacy", String.valueOf(idPrivacy))
|
||||||
|
.addParameter("nsfw", "false")
|
||||||
|
.addParameter("commentsEnabled", "true")
|
||||||
|
.addParameter("waitTranscoding", "true")
|
||||||
|
.setMaxRetries(2)
|
||||||
|
.startUpload();
|
||||||
|
finish();
|
||||||
|
} catch (Exception exc) {
|
||||||
|
exc.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,6 @@ package app.fedilab.android.activities;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
@ -225,12 +224,9 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorLi
|
||||||
public void onEditTextChangeListener(final View rootView, String text, int colorCode) {
|
public void onEditTextChangeListener(final View rootView, String text, int colorCode) {
|
||||||
TextEditorDialogFragment textEditorDialogFragment =
|
TextEditorDialogFragment textEditorDialogFragment =
|
||||||
TextEditorDialogFragment.show(this, text, colorCode);
|
TextEditorDialogFragment.show(this, text, colorCode);
|
||||||
textEditorDialogFragment.setOnTextEditorListener(new TextEditorDialogFragment.TextEditor() {
|
textEditorDialogFragment.setOnTextEditorListener((inputText, colorCode1) -> {
|
||||||
@Override
|
mPhotoEditor.editText(rootView, inputText, colorCode1);
|
||||||
public void onDone(String inputText, int colorCode) {
|
mTxtCurrentTool.setText(R.string.label_text);
|
||||||
mPhotoEditor.editText(rootView, inputText, colorCode);
|
|
||||||
mTxtCurrentTool.setText(R.string.label_text);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,6 +291,7 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorLi
|
||||||
|
|
||||||
File file = new File(myDir + "/" + filename);
|
File file = new File(myDir + "/" + filename);
|
||||||
try {
|
try {
|
||||||
|
//noinspection ResultOfMethodCallIgnored
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
|
|
||||||
SaveSettings saveSettings = new SaveSettings.Builder()
|
SaveSettings saveSettings = new SaveSettings.Builder()
|
||||||
|
@ -446,25 +443,10 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorLi
|
||||||
}
|
}
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, style);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this, style);
|
||||||
builder.setMessage(getString(R.string.confirm_exit_editing));
|
builder.setMessage(getString(R.string.confirm_exit_editing));
|
||||||
builder.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.save, (dialog, which) -> saveImage());
|
||||||
@Override
|
builder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
saveImage();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.setNegativeButton(R.string.discard, new DialogInterface.OnClickListener() {
|
builder.setNegativeButton(R.string.discard, (dialog, which) -> finish());
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -484,12 +466,9 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorLi
|
||||||
break;
|
break;
|
||||||
case TEXT:
|
case TEXT:
|
||||||
TextEditorDialogFragment textEditorDialogFragment = TextEditorDialogFragment.show(this);
|
TextEditorDialogFragment textEditorDialogFragment = TextEditorDialogFragment.show(this);
|
||||||
textEditorDialogFragment.setOnTextEditorListener(new TextEditorDialogFragment.TextEditor() {
|
textEditorDialogFragment.setOnTextEditorListener((inputText, colorCode) -> {
|
||||||
@Override
|
mPhotoEditor.addText(inputText, colorCode);
|
||||||
public void onDone(String inputText, int colorCode) {
|
mTxtCurrentTool.setText(R.string.label_text);
|
||||||
mPhotoEditor.addText(inputText, colorCode);
|
|
||||||
mTxtCurrentTool.setText(R.string.label_text);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ERASER:
|
case ERASER:
|
||||||
|
|
|
@ -21,7 +21,6 @@ import android.content.BroadcastReceiver;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -52,11 +51,9 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -113,6 +110,7 @@ import java.util.GregorianCalendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
@ -176,7 +174,6 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
public static boolean autocomplete;
|
public static boolean autocomplete;
|
||||||
public static Uri photoFileUri = null;
|
public static Uri photoFileUri = null;
|
||||||
static boolean active = false;
|
static boolean active = false;
|
||||||
private static String instance;
|
|
||||||
private static int searchDeep = 15;
|
private static int searchDeep = 15;
|
||||||
private final int PICK_IMAGE = 56556;
|
private final int PICK_IMAGE = 56556;
|
||||||
private final int TAKE_PHOTO = 56532;
|
private final int TAKE_PHOTO = 56532;
|
||||||
|
@ -198,7 +195,6 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
private TextView toot_space_left;
|
private TextView toot_space_left;
|
||||||
private String initialContent;
|
private String initialContent;
|
||||||
private Account accountReply;
|
private Account accountReply;
|
||||||
private String userId;
|
|
||||||
private Account account;
|
private Account account;
|
||||||
private boolean removed;
|
private boolean removed;
|
||||||
private boolean restoredScheduled;
|
private boolean restoredScheduled;
|
||||||
|
@ -228,9 +224,9 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
pixelfed_story.setEnabled(true);
|
pixelfed_story.setEnabled(true);
|
||||||
JSONObject response = null;
|
JSONObject response = null;
|
||||||
ArrayList<String> successfullyUploadedFiles = null;
|
ArrayList<String> successfullyUploadedFiles;
|
||||||
try {
|
try {
|
||||||
response = new JSONObject(intent.getStringExtra("response"));
|
response = new JSONObject(Objects.requireNonNull(intent.getStringExtra("response")));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -293,22 +289,19 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
|
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
Runnable myRunnable = new Runnable() {
|
Runnable myRunnable = () -> {
|
||||||
@Override
|
newContent[0] = newContent[0] + hugs.toString();
|
||||||
public void run() {
|
toot_content.setText(newContent[0]);
|
||||||
newContent[0] = newContent[0] + hugs.toString();
|
toot_content.setSelection(toot_content.getText().length());
|
||||||
toot_content.setText(newContent[0]);
|
// toot_content.addTextChangedListener(finalTextw);
|
||||||
toot_content.setSelection(toot_content.getText().length());
|
autocomplete = false;
|
||||||
// toot_content.addTextChangedListener(finalTextw);
|
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||||
autocomplete = false;
|
|
||||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
} else if (s.toString().contains(fedilabMorseTrigger)) {
|
} else if (s.toString().contains(fedilabMorseTrigger)) {
|
||||||
newContent[0] = s.toString().replaceAll(fedilabMorseTrigger, "").trim();
|
newContent[0] = s.toString().replaceAll(fedilabMorseTrigger, "").trim();
|
||||||
List<String> mentions = new ArrayList<>();
|
List<String> mentions = new ArrayList<>();
|
||||||
String mentionPattern = "@[a-z0-9_]+(@[a-z0-9\\.\\-]+[a-z0-9]+)?";
|
String mentionPattern = "@[a-z0-9_]+(@[a-z0-9.\\-]+[a-z0-9]+)?";
|
||||||
final Pattern mPattern = Pattern.compile(mentionPattern, Pattern.CASE_INSENSITIVE);
|
final Pattern mPattern = Pattern.compile(mentionPattern, Pattern.CASE_INSENSITIVE);
|
||||||
Matcher matcherMentions = mPattern.matcher(newContent[0]);
|
Matcher matcherMentions = mPattern.matcher(newContent[0]);
|
||||||
while (matcherMentions.find()) {
|
while (matcherMentions.find()) {
|
||||||
|
@ -343,14 +336,11 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
|
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
Runnable myRunnable = new Runnable() {
|
Runnable myRunnable = () -> {
|
||||||
@Override
|
toot_content.setText(newContent[0]);
|
||||||
public void run() {
|
toot_content.setSelection(toot_content.getText().length());
|
||||||
toot_content.setText(newContent[0]);
|
autocomplete = false;
|
||||||
toot_content.setSelection(toot_content.getText().length());
|
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||||
autocomplete = false;
|
|
||||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
}
|
}
|
||||||
|
@ -524,7 +514,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
String content = toot_content.getText().toString();
|
String content = toot_content.getText().toString();
|
||||||
String contentCount = content;
|
String contentCount = content;
|
||||||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
|
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
|
||||||
contentCount = contentCount.replaceAll("(?i)(^|[^/\\w])@(([a-z0-9_]+)@[a-z0-9\\.\\-]+[a-z0-9]+)", "$1@$3");
|
contentCount = contentCount.replaceAll("(?i)(^|[^/\\w])@(([a-z0-9_]+)@[a-z0-9.\\-]+[a-z0-9]+)", "$1@$3");
|
||||||
Matcher matcherALink = Patterns.WEB_URL.matcher(contentCount);
|
Matcher matcherALink = Patterns.WEB_URL.matcher(contentCount);
|
||||||
while (matcherALink.find()) {
|
while (matcherALink.find()) {
|
||||||
final String url = matcherALink.group(1);
|
final String url = matcherALink.group(1);
|
||||||
|
@ -540,16 +530,11 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
|
||||||
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(PixelfedComposeActivity.this));
|
|
||||||
final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
case Helper.THEME_LIGHT:
|
case Helper.THEME_LIGHT:
|
||||||
setTheme(R.style.AppTheme_Fedilab);
|
setTheme(R.style.AppTheme_Fedilab);
|
||||||
break;
|
break;
|
||||||
case Helper.THEME_DARK:
|
|
||||||
setTheme(R.style.AppThemeDark);
|
|
||||||
break;
|
|
||||||
case Helper.THEME_BLACK:
|
case Helper.THEME_BLACK:
|
||||||
setTheme(R.style.AppThemeBlack);
|
setTheme(R.style.AppThemeBlack);
|
||||||
break;
|
break;
|
||||||
|
@ -579,48 +564,39 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||||
ImageView close_toot = actionBar.getCustomView().findViewById(R.id.close_toot);
|
ImageView close_toot = actionBar.getCustomView().findViewById(R.id.close_toot);
|
||||||
|
|
||||||
close_toot.setOnClickListener(new View.OnClickListener() {
|
close_toot.setOnClickListener(v -> {
|
||||||
@Override
|
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||||
public void onClick(View v) {
|
assert inputMethodManager != null;
|
||||||
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
inputMethodManager.hideSoftInputFromWindow(toot_content.getWindowToken(), 0);
|
||||||
assert inputMethodManager != null;
|
boolean storeToot = sharedpreferences.getBoolean(Helper.SET_AUTO_STORE, true);
|
||||||
inputMethodManager.hideSoftInputFromWindow(toot_content.getWindowToken(), 0);
|
if (!storeToot) {
|
||||||
boolean storeToot = sharedpreferences.getBoolean(Helper.SET_AUTO_STORE, true);
|
if (toot_content.getText().toString().trim().length() == 0 && (attachments == null || attachments.size() < 1)) {
|
||||||
if (!storeToot) {
|
|
||||||
if (toot_content.getText().toString().trim().length() == 0 && (attachments == null || attachments.size() < 1)) {
|
|
||||||
finish();
|
|
||||||
} else if (initialContent.trim().equals(toot_content.getText().toString().trim())) {
|
|
||||||
finish();
|
|
||||||
} else {
|
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
|
||||||
dialogBuilder.setMessage(R.string.save_draft);
|
|
||||||
dialogBuilder.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
if (accountReply == null) {
|
|
||||||
storeToot(true, false);
|
|
||||||
} else {
|
|
||||||
storeToot(false, false);
|
|
||||||
}
|
|
||||||
dialog.dismiss();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialogBuilder.setNegativeButton(R.string.discard, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
dialog.dismiss();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AlertDialog alertDialog = dialogBuilder.create();
|
|
||||||
alertDialog.setCancelable(false);
|
|
||||||
alertDialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
finish();
|
finish();
|
||||||
|
} else if (initialContent.trim().equals(toot_content.getText().toString().trim())) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||||
|
dialogBuilder.setMessage(R.string.save_draft);
|
||||||
|
dialogBuilder.setPositiveButton(R.string.save, (dialog, id) -> {
|
||||||
|
if (accountReply == null) {
|
||||||
|
storeToot(true, false);
|
||||||
|
} else {
|
||||||
|
storeToot(false, false);
|
||||||
|
}
|
||||||
|
dialog.dismiss();
|
||||||
|
finish();
|
||||||
|
});
|
||||||
|
dialogBuilder.setNegativeButton(R.string.discard, (dialog, id) -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
finish();
|
||||||
|
});
|
||||||
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
|
alertDialog.setCancelable(false);
|
||||||
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
|
@ -658,11 +634,8 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
if (sharedpreferences.getBoolean(Helper.SET_DISPLAY_EMOJI, false)) {
|
if (sharedpreferences.getBoolean(Helper.SET_DISPLAY_EMOJI, false)) {
|
||||||
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(drawer_layout).build(toot_content);
|
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(drawer_layout).build(toot_content);
|
||||||
|
|
||||||
toot_emoji.setOnClickListener(new View.OnClickListener() {
|
toot_emoji.setOnClickListener(v -> {
|
||||||
@Override
|
emojiPopup.toggle(); // Toggles visibility of the Popup.
|
||||||
public void onClick(View v) {
|
|
||||||
emojiPopup.toggle(); // Toggles visibility of the Popup.
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toot_emoji.setVisibility(View.GONE);
|
toot_emoji.setVisibility(View.GONE);
|
||||||
|
@ -772,94 +745,73 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
toot_sensitive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
toot_sensitive.setOnCheckedChangeListener((buttonView, isChecked) -> isSensitive = isChecked);
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
isSensitive = isChecked;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||||
|
|
||||||
|
|
||||||
toot_visibility.setOnClickListener(new View.OnClickListener() {
|
toot_visibility.setOnClickListener(v -> tootVisibilityDialog());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
toot_it.setOnClickListener(v -> sendToot(null));
|
||||||
tootVisibilityDialog();
|
|
||||||
|
|
||||||
|
pickup_picture.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
if (ContextCompat.checkSelfPermission(PixelfedComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||||
|
PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(PixelfedComposeActivity.this,
|
||||||
|
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
|
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
Intent intent;
|
||||||
|
intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
intent.setType("*/*");
|
||||||
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
|
String[] mimetypes = {"image/*", "video/*", "audio/mpeg", "audio/opus", "audio/flac", "audio/wav", "audio/ogg"};
|
||||||
|
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
||||||
|
startActivityForResult(intent, PICK_IMAGE);
|
||||||
|
} else {
|
||||||
|
intent.setType("image/* video/* audio/mpeg audio/opus audio/flac audio/wav audio/ogg");
|
||||||
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
|
Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
|
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
|
||||||
|
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
|
||||||
|
startActivityForResult(chooserIntent, PICK_IMAGE);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
toot_it.setOnClickListener(new View.OnClickListener() {
|
upload_media.setOnClickListener(v -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
if (ContextCompat.checkSelfPermission(PixelfedComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||||
sendToot(null);
|
PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(PixelfedComposeActivity.this,
|
||||||
|
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
|
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
Intent intent;
|
||||||
|
intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
pickup_picture.setOnClickListener(new View.OnClickListener() {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
@Override
|
intent.setType("*/*");
|
||||||
public void onClick(View v) {
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
|
String[] mimetypes = {"image/*", "video/*", "audio/mpeg", "audio/opus", "audio/flac", "audio/wav", "audio/ogg"};
|
||||||
if (ContextCompat.checkSelfPermission(PixelfedComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
||||||
PackageManager.PERMISSION_GRANTED) {
|
startActivityForResult(intent, PICK_IMAGE);
|
||||||
ActivityCompat.requestPermissions(PixelfedComposeActivity.this,
|
} else {
|
||||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
intent.setType("image/* video/* audio/mpeg audio/opus audio/flac audio/wav audio/ogg");
|
||||||
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
return;
|
Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
}
|
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
|
||||||
Intent intent;
|
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
|
||||||
intent = new Intent(Intent.ACTION_GET_CONTENT);
|
startActivityForResult(chooserIntent, PICK_IMAGE);
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
||||||
intent.setType("*/*");
|
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
||||||
String[] mimetypes = {"image/*", "video/*", "audio/mpeg", "audio/opus", "audio/flac", "audio/wav", "audio/ogg"};
|
|
||||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
|
||||||
startActivityForResult(intent, PICK_IMAGE);
|
|
||||||
} else {
|
|
||||||
intent.setType("image/* video/* audio/mpeg audio/opus audio/flac audio/wav audio/ogg");
|
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
||||||
Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
|
||||||
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
|
|
||||||
startActivityForResult(chooserIntent, PICK_IMAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
upload_media.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
if (ContextCompat.checkSelfPermission(PixelfedComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
|
||||||
PackageManager.PERMISSION_GRANTED) {
|
|
||||||
ActivityCompat.requestPermissions(PixelfedComposeActivity.this,
|
|
||||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
|
||||||
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Intent intent;
|
|
||||||
intent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
||||||
intent.setType("*/*");
|
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
||||||
String[] mimetypes = {"image/*", "video/*", "audio/mpeg", "audio/opus", "audio/flac", "audio/wav", "audio/ogg"};
|
|
||||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
|
||||||
startActivityForResult(intent, PICK_IMAGE);
|
|
||||||
} else {
|
|
||||||
intent.setType("image/* video/* audio/mpeg audio/opus audio/flac audio/wav audio/ogg");
|
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
||||||
Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
|
||||||
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
|
|
||||||
startActivityForResult(chooserIntent, PICK_IMAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -1184,7 +1136,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
}
|
}
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||||
LayoutInflater inflater = this.getLayoutInflater();
|
LayoutInflater inflater = this.getLayoutInflater();
|
||||||
View dialogView = inflater.inflate(R.layout.datetime_picker, null);
|
View dialogView = inflater.inflate(R.layout.datetime_picker, new LinearLayout(PixelfedComposeActivity.this), false);
|
||||||
dialogBuilder.setView(dialogView);
|
dialogBuilder.setView(dialogView);
|
||||||
final AlertDialog alertDialog = dialogBuilder.create();
|
final AlertDialog alertDialog = dialogBuilder.create();
|
||||||
|
|
||||||
|
@ -1198,74 +1150,54 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
final ImageButton date_time_set = dialogView.findViewById(R.id.date_time_set);
|
final ImageButton date_time_set = dialogView.findViewById(R.id.date_time_set);
|
||||||
|
|
||||||
//Buttons management
|
//Buttons management
|
||||||
date_time_cancel.setOnClickListener(new View.OnClickListener() {
|
date_time_cancel.setOnClickListener(v -> alertDialog.dismiss());
|
||||||
@Override
|
date_time_next.setOnClickListener(v -> {
|
||||||
public void onClick(View v) {
|
datePicker.setVisibility(View.GONE);
|
||||||
alertDialog.dismiss();
|
timePicker.setVisibility(View.VISIBLE);
|
||||||
}
|
date_time_previous.setVisibility(View.VISIBLE);
|
||||||
|
date_time_next.setVisibility(View.GONE);
|
||||||
|
date_time_set.setVisibility(View.VISIBLE);
|
||||||
});
|
});
|
||||||
date_time_next.setOnClickListener(new View.OnClickListener() {
|
date_time_previous.setOnClickListener(v -> {
|
||||||
@Override
|
datePicker.setVisibility(View.VISIBLE);
|
||||||
public void onClick(View v) {
|
timePicker.setVisibility(View.GONE);
|
||||||
datePicker.setVisibility(View.GONE);
|
date_time_previous.setVisibility(View.GONE);
|
||||||
timePicker.setVisibility(View.VISIBLE);
|
date_time_next.setVisibility(View.VISIBLE);
|
||||||
date_time_previous.setVisibility(View.VISIBLE);
|
date_time_set.setVisibility(View.GONE);
|
||||||
date_time_next.setVisibility(View.GONE);
|
|
||||||
date_time_set.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
date_time_previous.setOnClickListener(new View.OnClickListener() {
|
date_time_set.setOnClickListener(v -> {
|
||||||
@Override
|
int hour, minute;
|
||||||
public void onClick(View v) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
datePicker.setVisibility(View.VISIBLE);
|
hour = timePicker.getHour();
|
||||||
timePicker.setVisibility(View.GONE);
|
minute = timePicker.getMinute();
|
||||||
date_time_previous.setVisibility(View.GONE);
|
} else {
|
||||||
date_time_next.setVisibility(View.VISIBLE);
|
hour = timePicker.getCurrentHour();
|
||||||
date_time_set.setVisibility(View.GONE);
|
minute = timePicker.getCurrentMinute();
|
||||||
}
|
}
|
||||||
});
|
Calendar calendar = new GregorianCalendar(datePicker.getYear(),
|
||||||
date_time_set.setOnClickListener(new View.OnClickListener() {
|
datePicker.getMonth(),
|
||||||
@Override
|
datePicker.getDayOfMonth(),
|
||||||
public void onClick(View v) {
|
hour,
|
||||||
int hour, minute;
|
minute);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
final long[] time = {calendar.getTimeInMillis()};
|
||||||
hour = timePicker.getHour();
|
|
||||||
minute = timePicker.getMinute();
|
|
||||||
} else {
|
|
||||||
hour = timePicker.getCurrentHour();
|
|
||||||
minute = timePicker.getCurrentMinute();
|
|
||||||
}
|
|
||||||
Calendar calendar = new GregorianCalendar(datePicker.getYear(),
|
|
||||||
datePicker.getMonth(),
|
|
||||||
datePicker.getDayOfMonth(),
|
|
||||||
hour,
|
|
||||||
minute);
|
|
||||||
final long[] time = {calendar.getTimeInMillis()};
|
|
||||||
|
|
||||||
if ((time[0] - new Date().getTime()) < 60000) {
|
if ((time[0] - new Date().getTime()) < 60000) {
|
||||||
Toasty.warning(PixelfedComposeActivity.this, getString(R.string.toot_scheduled_date), Toast.LENGTH_LONG).show();
|
Toasty.warning(PixelfedComposeActivity.this, getString(R.string.toot_scheduled_date), Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||||
builderSingle.setTitle(getString(R.string.choose_schedule));
|
builderSingle.setTitle(getString(R.string.choose_schedule));
|
||||||
builderSingle.setNegativeButton(R.string.device_schedule, new DialogInterface.OnClickListener() {
|
builderSingle.setNegativeButton(R.string.device_schedule, (dialog, which) -> {
|
||||||
@Override
|
deviceSchedule(time[0]);
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
dialog.dismiss();
|
||||||
deviceSchedule(time[0]);
|
});
|
||||||
dialog.dismiss();
|
builderSingle.setPositiveButton(R.string.server_schedule, (dialog, which) -> {
|
||||||
}
|
int offset = TimeZone.getDefault().getRawOffset();
|
||||||
});
|
calendar.add(Calendar.MILLISECOND, -offset);
|
||||||
builderSingle.setPositiveButton(R.string.server_schedule, new DialogInterface.OnClickListener() {
|
final String date = Helper.dateToString(new Date(calendar.getTimeInMillis()));
|
||||||
@Override
|
serverSchedule(date);
|
||||||
public void onClick(final DialogInterface dialog, int which) {
|
});
|
||||||
int offset = TimeZone.getDefault().getRawOffset();
|
builderSingle.show();
|
||||||
calendar.add(Calendar.MILLISECOND, -offset);
|
alertDialog.dismiss();
|
||||||
final String date = Helper.dateToString(new Date(calendar.getTimeInMillis()));
|
|
||||||
serverSchedule(date);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builderSingle.show();
|
|
||||||
alertDialog.dismiss();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
@ -1336,8 +1268,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
if (namebar != null && namebar.getParent() != null)
|
if (namebar != null && namebar.getParent() != null)
|
||||||
((ViewGroup) namebar.getParent()).removeView(namebar);
|
((ViewGroup) namebar.getParent()).removeView(namebar);
|
||||||
}
|
}
|
||||||
List<Attachment> tmp_attachment = new ArrayList<>();
|
List<Attachment> tmp_attachment = new ArrayList<>(attachments);
|
||||||
tmp_attachment.addAll(attachments);
|
|
||||||
attachments.removeAll(tmp_attachment);
|
attachments.removeAll(tmp_attachment);
|
||||||
tmp_attachment.clear();
|
tmp_attachment.clear();
|
||||||
}
|
}
|
||||||
|
@ -1413,36 +1344,28 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
dialog.setTitle(R.string.toot_visibility_tilte);
|
dialog.setTitle(R.string.toot_visibility_tilte);
|
||||||
final String[] stringArray = getResources().getStringArray(R.array.toot_visibility);
|
final String[] stringArray = getResources().getStringArray(R.array.toot_visibility);
|
||||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(PixelfedComposeActivity.this, android.R.layout.simple_list_item_1, stringArray);
|
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(PixelfedComposeActivity.this, android.R.layout.simple_list_item_1, stringArray);
|
||||||
dialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
dialog.setNegativeButton(R.string.cancel, (dialog12, position) -> dialog12.dismiss());
|
||||||
@Override
|
dialog.setAdapter(arrayAdapter, (dialog1, position) -> {
|
||||||
public void onClick(DialogInterface dialog, int position) {
|
switch (position) {
|
||||||
dialog.dismiss();
|
case 0:
|
||||||
|
visibility = "public";
|
||||||
|
toot_visibility.setImageResource(R.drawable.ic_public_toot);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
visibility = "unlisted";
|
||||||
|
toot_visibility.setImageResource(R.drawable.ic_lock_open_toot);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
visibility = "private";
|
||||||
|
toot_visibility.setImageResource(R.drawable.ic_lock_outline_toot);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
visibility = "direct";
|
||||||
|
toot_visibility.setImageResource(R.drawable.ic_mail_outline_toot);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
dialog.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int position) {
|
|
||||||
switch (position) {
|
|
||||||
case 0:
|
|
||||||
visibility = "public";
|
|
||||||
toot_visibility.setImageResource(R.drawable.ic_public_toot);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
visibility = "unlisted";
|
|
||||||
toot_visibility.setImageResource(R.drawable.ic_lock_open_toot);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
visibility = "private";
|
|
||||||
toot_visibility.setImageResource(R.drawable.ic_lock_outline_toot);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
visibility = "direct";
|
|
||||||
toot_visibility.setImageResource(R.drawable.ic_mail_outline_toot);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog.dismiss();
|
dialog1.dismiss();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
@ -1478,24 +1401,18 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PixelfedComposeActivity.this, style);
|
||||||
dialogBuilder.setMessage(R.string.save_draft);
|
dialogBuilder.setMessage(R.string.save_draft);
|
||||||
dialogBuilder.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
|
dialogBuilder.setPositiveButton(R.string.save, (dialog, id) -> {
|
||||||
@Override
|
if (accountReply == null) {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
storeToot(true, false);
|
||||||
if (accountReply == null) {
|
} else {
|
||||||
storeToot(true, false);
|
storeToot(false, false);
|
||||||
} else {
|
|
||||||
storeToot(false, false);
|
|
||||||
}
|
|
||||||
dialog.dismiss();
|
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
|
dialog.dismiss();
|
||||||
|
finish();
|
||||||
});
|
});
|
||||||
dialogBuilder.setNegativeButton(R.string.discard, new DialogInterface.OnClickListener() {
|
dialogBuilder.setNegativeButton(R.string.discard, (dialog, id) -> {
|
||||||
@Override
|
dialog.dismiss();
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
finish();
|
||||||
dialog.dismiss();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
AlertDialog alertDialog = dialogBuilder.create();
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
alertDialog.setCancelable(false);
|
alertDialog.setCancelable(false);
|
||||||
|
@ -1549,8 +1466,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
if (namebar != null && namebar.getParent() != null)
|
if (namebar != null && namebar.getParent() != null)
|
||||||
((ViewGroup) namebar.getParent()).removeView(namebar);
|
((ViewGroup) namebar.getParent()).removeView(namebar);
|
||||||
}
|
}
|
||||||
List<Attachment> tmp_attachment = new ArrayList<>();
|
List<Attachment> tmp_attachment = new ArrayList<>(attachments);
|
||||||
tmp_attachment.addAll(attachments);
|
|
||||||
attachments.removeAll(tmp_attachment);
|
attachments.removeAll(tmp_attachment);
|
||||||
tmp_attachment.clear();
|
tmp_attachment.clear();
|
||||||
}
|
}
|
||||||
|
@ -1597,37 +1513,34 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
String[] searchA = oldContent.substring(0, currentCursorPosition).split("@");
|
String[] searchA = oldContent.substring(0, currentCursorPosition).split("@");
|
||||||
if (searchA.length > 0) {
|
if (searchA.length > 0) {
|
||||||
final String search = searchA[searchA.length - 1];
|
final String search = searchA[searchA.length - 1];
|
||||||
toot_content.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
toot_content.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
@Override
|
Account account = accounts.get(position);
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
String deltaSearch = "";
|
||||||
Account account = accounts.get(position);
|
int searchLength = searchDeep;
|
||||||
String deltaSearch = "";
|
if (currentCursorPosition < searchDeep) { //Less than 15 characters are written before the cursor position
|
||||||
int searchLength = searchDeep;
|
searchLength = currentCursorPosition;
|
||||||
if (currentCursorPosition < searchDeep) { //Less than 15 characters are written before the cursor position
|
|
||||||
searchLength = currentCursorPosition;
|
|
||||||
}
|
|
||||||
if (currentCursorPosition - searchLength > 0 && currentCursorPosition < oldContent.length())
|
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength, currentCursorPosition);
|
|
||||||
else {
|
|
||||||
if (currentCursorPosition >= oldContent.length())
|
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!search.equals(""))
|
|
||||||
deltaSearch = deltaSearch.replace("@" + search, "");
|
|
||||||
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
|
||||||
newContent += deltaSearch;
|
|
||||||
newContent += "@" + account.getAcct() + " ";
|
|
||||||
int newPosition = newContent.length();
|
|
||||||
if (currentCursorPosition < oldContent.length())
|
|
||||||
newContent += oldContent.substring(currentCursorPosition);
|
|
||||||
toot_content.setText(newContent);
|
|
||||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
|
||||||
toot_content.setSelection(newPosition);
|
|
||||||
AccountsSearchAdapter accountsListAdapter = new AccountsSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
|
||||||
toot_content.setThreshold(1);
|
|
||||||
toot_content.setAdapter(accountsListAdapter);
|
|
||||||
}
|
}
|
||||||
|
if (currentCursorPosition - searchLength > 0 && currentCursorPosition < oldContent.length())
|
||||||
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength, currentCursorPosition);
|
||||||
|
else {
|
||||||
|
if (currentCursorPosition >= oldContent.length())
|
||||||
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!search.equals(""))
|
||||||
|
deltaSearch = deltaSearch.replace("@" + search, "");
|
||||||
|
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
||||||
|
newContent += deltaSearch;
|
||||||
|
newContent += "@" + account.getAcct() + " ";
|
||||||
|
int newPosition = newContent.length();
|
||||||
|
if (currentCursorPosition < oldContent.length())
|
||||||
|
newContent += oldContent.substring(currentCursorPosition);
|
||||||
|
toot_content.setText(newContent);
|
||||||
|
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||||
|
toot_content.setSelection(newPosition);
|
||||||
|
AccountsSearchAdapter accountsListAdapter1 = new AccountsSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
||||||
|
toot_content.setThreshold(1);
|
||||||
|
toot_content.setAdapter(accountsListAdapter1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1664,38 +1577,35 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
String[] searchA = oldContent.substring(0, currentCursorPosition).split(":");
|
String[] searchA = oldContent.substring(0, currentCursorPosition).split(":");
|
||||||
if (searchA.length > 0) {
|
if (searchA.length > 0) {
|
||||||
final String search = searchA[searchA.length - 1];
|
final String search = searchA[searchA.length - 1];
|
||||||
toot_content.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
toot_content.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
@Override
|
String shortcode = emojis.get(position).getShortcode();
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
String deltaSearch = "";
|
||||||
String shortcode = emojis.get(position).getShortcode();
|
int searchLength = searchDeep;
|
||||||
String deltaSearch = "";
|
if (currentCursorPosition < searchDeep) { //Less than 15 characters are written before the cursor position
|
||||||
int searchLength = searchDeep;
|
searchLength = currentCursorPosition;
|
||||||
if (currentCursorPosition < searchDeep) { //Less than 15 characters are written before the cursor position
|
|
||||||
searchLength = currentCursorPosition;
|
|
||||||
}
|
|
||||||
if (currentCursorPosition - searchLength > 0 && currentCursorPosition < oldContent.length())
|
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength, currentCursorPosition);
|
|
||||||
else {
|
|
||||||
if (currentCursorPosition >= oldContent.length())
|
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!search.equals(""))
|
|
||||||
deltaSearch = deltaSearch.replace(":" + search, "");
|
|
||||||
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
|
||||||
newContent += deltaSearch;
|
|
||||||
newContent += ":" + shortcode + ": ";
|
|
||||||
int newPosition = newContent.length();
|
|
||||||
if (currentCursorPosition < oldContent.length())
|
|
||||||
newContent += oldContent.substring(currentCursorPosition);
|
|
||||||
toot_content.setText(newContent);
|
|
||||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
|
||||||
toot_content.setSelection(newPosition);
|
|
||||||
EmojisSearchAdapter emojisSearchAdapter = new EmojisSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
|
||||||
toot_content.setThreshold(1);
|
|
||||||
toot_content.setAdapter(emojisSearchAdapter);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (currentCursorPosition - searchLength > 0 && currentCursorPosition < oldContent.length())
|
||||||
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength, currentCursorPosition);
|
||||||
|
else {
|
||||||
|
if (currentCursorPosition >= oldContent.length())
|
||||||
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!search.equals(""))
|
||||||
|
deltaSearch = deltaSearch.replace(":" + search, "");
|
||||||
|
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
||||||
|
newContent += deltaSearch;
|
||||||
|
newContent += ":" + shortcode + ": ";
|
||||||
|
int newPosition = newContent.length();
|
||||||
|
if (currentCursorPosition < oldContent.length())
|
||||||
|
newContent += oldContent.substring(currentCursorPosition);
|
||||||
|
toot_content.setText(newContent);
|
||||||
|
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||||
|
toot_content.setSelection(newPosition);
|
||||||
|
EmojisSearchAdapter emojisSearchAdapter1 = new EmojisSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
||||||
|
toot_content.setThreshold(1);
|
||||||
|
toot_content.setAdapter(emojisSearchAdapter1);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1725,40 +1635,37 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
if (searchA.length < 1)
|
if (searchA.length < 1)
|
||||||
return;
|
return;
|
||||||
final String search = searchA[searchA.length - 1];
|
final String search = searchA[searchA.length - 1];
|
||||||
toot_content.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
toot_content.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
@Override
|
if (position >= tags.size())
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
return;
|
||||||
if (position >= tags.size())
|
String tag = tags.get(position);
|
||||||
return;
|
String deltaSearch = "";
|
||||||
String tag = tags.get(position);
|
int searchLength = searchDeep;
|
||||||
String deltaSearch = "";
|
if (currentCursorPosition < searchDeep) { //Less than 15 characters are written before the cursor position
|
||||||
int searchLength = searchDeep;
|
searchLength = currentCursorPosition;
|
||||||
if (currentCursorPosition < searchDeep) { //Less than 15 characters are written before the cursor position
|
|
||||||
searchLength = currentCursorPosition;
|
|
||||||
}
|
|
||||||
if (currentCursorPosition - searchLength > 0 && currentCursorPosition < oldContent.length())
|
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength, currentCursorPosition);
|
|
||||||
else {
|
|
||||||
if (currentCursorPosition >= oldContent.length())
|
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!search.equals(""))
|
|
||||||
deltaSearch = deltaSearch.replace("#" + search, "");
|
|
||||||
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
|
||||||
newContent += deltaSearch;
|
|
||||||
newContent += "#" + tag + " ";
|
|
||||||
int newPosition = newContent.length();
|
|
||||||
if (currentCursorPosition < oldContent.length())
|
|
||||||
newContent += oldContent.substring(currentCursorPosition);
|
|
||||||
toot_content.setText(newContent);
|
|
||||||
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
|
||||||
toot_content.setSelection(newPosition);
|
|
||||||
TagsSearchAdapter tagsSearchAdapter = new TagsSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
|
||||||
toot_content.setThreshold(1);
|
|
||||||
toot_content.setAdapter(tagsSearchAdapter);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (currentCursorPosition - searchLength > 0 && currentCursorPosition < oldContent.length())
|
||||||
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength, currentCursorPosition);
|
||||||
|
else {
|
||||||
|
if (currentCursorPosition >= oldContent.length())
|
||||||
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!search.equals(""))
|
||||||
|
deltaSearch = deltaSearch.replace("#" + search, "");
|
||||||
|
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
||||||
|
newContent += deltaSearch;
|
||||||
|
newContent += "#" + tag + " ";
|
||||||
|
int newPosition = newContent.length();
|
||||||
|
if (currentCursorPosition < oldContent.length())
|
||||||
|
newContent += oldContent.substring(currentCursorPosition);
|
||||||
|
toot_content.setText(newContent);
|
||||||
|
toot_space_left.setText(String.valueOf(countLength(social, toot_content)));
|
||||||
|
toot_content.setSelection(newPosition);
|
||||||
|
TagsSearchAdapter tagsSearchAdapter1 = new TagsSearchAdapter(PixelfedComposeActivity.this, new ArrayList<>());
|
||||||
|
toot_content.setThreshold(1);
|
||||||
|
toot_content.setAdapter(tagsSearchAdapter1);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1776,10 +1683,9 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
restored = id;
|
restored = id;
|
||||||
attachments = status.getMedia_attachments();
|
attachments = status.getMedia_attachments();
|
||||||
|
|
||||||
ArrayList<ImageView> toRemove = new ArrayList<>();
|
|
||||||
|
|
||||||
String content = status.getContent();
|
String content = status.getContent();
|
||||||
Pattern mentionLink = Pattern.compile("(<\\s?a\\s?href=\"https?:\\/\\/([\\da-z\\.-]+\\.[a-z\\.]{2,10})\\/(@[\\/\\w._-]*)\"\\s?[^.]*<\\s?\\/\\s?a\\s?>)");
|
Pattern mentionLink = Pattern.compile("(<\\s?a\\s?href=\"https?://([\\da-z.-]+\\.[a-z.]{2,10})/(@[/\\w._-]*)\"\\s?[^.]*<\\s?/\\s?a\\s?>)");
|
||||||
Matcher matcher = mentionLink.matcher(content);
|
Matcher matcher = mentionLink.matcher(content);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
content = matcher.replaceAll("$3@$2");
|
content = matcher.replaceAll("$3@$2");
|
||||||
|
@ -1870,10 +1776,8 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
private void restoreServerSchedule(Status status) {
|
private void restoreServerSchedule(Status status) {
|
||||||
|
|
||||||
attachments = status.getMedia_attachments();
|
attachments = status.getMedia_attachments();
|
||||||
ArrayList<ImageView> toRemove = new ArrayList<>();
|
|
||||||
|
|
||||||
String content = status.getContent();
|
String content = status.getContent();
|
||||||
Pattern mentionLink = Pattern.compile("(<\\s?a\\s?href=\"https?:\\/\\/([\\da-z\\.-]+\\.[a-z\\.]{2,10})\\/(@[\\/\\w._-]*)\"\\s?[^.]*<\\s?\\/\\s?a\\s?>)");
|
Pattern mentionLink = Pattern.compile("(<\\s?a\\s?href=\"https?://([\\da-z.-]+\\.[a-z.]{2,10})/(@[/\\w._-]*)\"\\s?[^.]*<\\s?/\\s?a\\s?>)");
|
||||||
Matcher matcher = mentionLink.matcher(content);
|
Matcher matcher = mentionLink.matcher(content);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
content = matcher.replaceAll("$3@$2");
|
content = matcher.replaceAll("$3@$2");
|
||||||
|
@ -1885,7 +1789,6 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
content = Html.fromHtml(content).toString();
|
content = Html.fromHtml(content).toString();
|
||||||
}
|
}
|
||||||
if (attachments != null && attachments.size() > 0) {
|
if (attachments != null && attachments.size() > 0) {
|
||||||
int i = 0;
|
|
||||||
for (final Attachment attachment : attachments) {
|
for (final Attachment attachment : attachments) {
|
||||||
String url = attachment.getPreview_url();
|
String url = attachment.getPreview_url();
|
||||||
if (url == null || url.trim().equals(""))
|
if (url == null || url.trim().equals(""))
|
||||||
|
@ -1910,17 +1813,10 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
});
|
});
|
||||||
imageView.setTag(attachment.getId());
|
imageView.setTag(attachment.getId());
|
||||||
|
|
||||||
imageView.setOnLongClickListener(new View.OnLongClickListener() {
|
imageView.setOnLongClickListener(view -> false);
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View view) {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (attachments.size() < max_media_count)
|
if (attachments.size() < max_media_count)
|
||||||
upload_media.setEnabled(true);
|
upload_media.setEnabled(true);
|
||||||
toot_sensitive.setVisibility(View.VISIBLE);
|
toot_sensitive.setVisibility(View.VISIBLE);
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
imageSlider.setVisibility(View.GONE);
|
imageSlider.setVisibility(View.GONE);
|
||||||
|
@ -2025,7 +1921,6 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
boolean error = false;
|
boolean error = false;
|
||||||
UploadServiceSingleBroadcastReceiver uploadReceiver;
|
UploadServiceSingleBroadcastReceiver uploadReceiver;
|
||||||
String filename;
|
String filename;
|
||||||
UpdateAccountInfoAsyncTask.SOCIAL social;
|
|
||||||
boolean pixelfedStory;
|
boolean pixelfedStory;
|
||||||
|
|
||||||
asyncPicture(Activity activity, boolean pixelfedStory, Uri uri, String filename, UploadServiceSingleBroadcastReceiver uploadReceiver) {
|
asyncPicture(Activity activity, boolean pixelfedStory, Uri uri, String filename, UploadServiceSingleBroadcastReceiver uploadReceiver) {
|
||||||
|
|
Loading…
Reference in New Issue