toRemove = new ArrayList<>();
- if( childCount > 0 ){
- for(int i = 0 ; i < childCount ; i++){
- if( toot_picture_container.getChildAt(i) instanceof ImageView)
- toRemove.add((ImageView)toot_picture_container.getChildAt(i));
+ if (childCount > 0) {
+ for (int i = 0; i < childCount; i++) {
+ if (toot_picture_container.getChildAt(i) instanceof ImageView)
+ toRemove.add((ImageView) toot_picture_container.getChildAt(i));
}
- if( toRemove.size() > 0){
- for(ImageView imageView: toRemove)
+ if (toRemove.size() > 0) {
+ for (ImageView imageView : toRemove)
toot_picture_container.removeView(imageView);
}
toRemove.clear();
@@ -3147,29 +3145,29 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
content = matcher.replaceAll("$3@$2");
}
- if( removed ) {
+ if (removed) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
content = Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
content = Html.fromHtml(content).toString();
}
- if( status.getPoll() != null) {
+ if (status.getPoll() != null) {
poll = status.getPoll();
poll_action.setVisibility(View.VISIBLE);
- if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
+ if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
toot_picture.setVisibility(View.GONE);
picture_scrollview.setVisibility(View.GONE);
}
}
- if( attachments != null && attachments.size() > 0){
+ if (attachments != null && attachments.size() > 0) {
toot_picture_container.setVisibility(View.VISIBLE);
picture_scrollview.setVisibility(View.VISIBLE);
- int i = 0 ;
- for(final Attachment attachment: attachments){
+ int i = 0;
+ for (final Attachment attachment : attachments) {
String url = attachment.getPreview_url();
- if( url == null || url.trim().equals(""))
+ if (url == null || url.trim().equals(""))
url = attachment.getUrl();
final ImageView imageView = new ImageView(getApplicationContext());
imageView.setId(Integer.parseInt(attachment.getId()));
@@ -3218,47 +3216,47 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
}
});
addBorder();
- if( attachments.size() < max_media_count)
+ if (attachments.size() < max_media_count)
toot_picture.setEnabled(true);
toot_sensitive.setVisibility(View.VISIBLE);
i++;
}
- }else {
+ } else {
toot_picture_container.setVisibility(View.GONE);
}
//Sensitive content
toot_sensitive.setChecked(status.isSensitive());
- if( status.getSpoiler_text() != null && status.getSpoiler_text().length() > 0 ){
+ if (status.getSpoiler_text() != null && status.getSpoiler_text().length() > 0) {
toot_cw_content.setText(status.getSpoiler_text());
toot_cw_content.setVisibility(View.VISIBLE);
- }else {
+ } else {
toot_cw_content.setText("");
toot_cw_content.setVisibility(View.GONE);
}
- if( !displayWYSIWYG()) {
+ if (!displayWYSIWYG()) {
toot_content.setText(content);
- }else{
- if( content != null){
- content =content.replaceAll("]*><\\/p>","");
+ } else {
+ if (content != null) {
+ content = content.replaceAll("
]*><\\/p>", "");
}
wysiwyg.render(content);
try {
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_SHORT).show();
}
}
toot_space_left.setText(String.valueOf(countLength(social, toot_content, toot_cw_content)));
- if( !displayWYSIWYG()) {
+ if (!displayWYSIWYG()) {
toot_content.setSelection(toot_content.getText().length());
- }else{
- if( wysiwygEditText != null) {
+ } else {
+ if (wysiwygEditText != null) {
wysiwygEditText.setSelection(wysiwygEditText.getText().length());
}
}
- switch (status.getVisibility()){
+ switch (status.getVisibility()) {
case "public":
visibility = "public";
toot_visibility.setImageResource(R.drawable.ic_public_toot);
@@ -3280,17 +3278,16 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
//The current id is set to the draft
currentToId = draft.getId();
tootReply = draft.getStatusReply();
- if( tootReply != null) {
+ if (tootReply != null) {
tootReply();
- }else {
- if( title != null){
- if(social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
+ } else {
+ if (title != null) {
+ if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
title.setText(getString(R.string.queet_title));
else
title.setText(getString(R.string.toot_title));
- }
- else {
+ } else {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
setTitle(R.string.queet_title);
else
@@ -3298,27 +3295,27 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
}
}
invalidateOptionsMenu();
- initialContent = displayWYSIWYG()?wysiwyg.getContentAsHTML():toot_content.getText().toString();
- if( !displayWYSIWYG()) {
+ initialContent = displayWYSIWYG() ? wysiwyg.getContentAsHTML() : toot_content.getText().toString();
+ if (!displayWYSIWYG()) {
toot_space_left.setText(String.valueOf(countLength(social, toot_content, toot_cw_content)));
- }else{
+ } else {
toot_space_left.setText(String.valueOf(countLength(wysiwyg, toot_cw_content)));
}
}
- private void restoreServerSchedule(Status status){
+ private void restoreServerSchedule(Status status) {
attachments = status.getMedia_attachments();
int childCount = toot_picture_container.getChildCount();
ArrayList toRemove = new ArrayList<>();
- if( childCount > 0 ){
- for(int i = 0 ; i < childCount ; i++){
- if( toot_picture_container.getChildAt(i) instanceof ImageView)
- toRemove.add((ImageView)toot_picture_container.getChildAt(i));
+ if (childCount > 0) {
+ for (int i = 0; i < childCount; i++) {
+ if (toot_picture_container.getChildAt(i) instanceof ImageView)
+ toRemove.add((ImageView) toot_picture_container.getChildAt(i));
}
- if( toRemove.size() > 0){
- for(ImageView imageView: toRemove)
+ if (toRemove.size() > 0) {
+ for (ImageView imageView : toRemove)
toot_picture_container.removeView(imageView);
}
toRemove.clear();
@@ -3329,20 +3326,20 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
if (matcher.find()) {
content = matcher.replaceAll("$3@$2");
}
- if( removed ) {
+ if (removed) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
content = Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
content = Html.fromHtml(content).toString();
}
- if( attachments != null && attachments.size() > 0){
+ if (attachments != null && attachments.size() > 0) {
toot_picture_container.setVisibility(View.VISIBLE);
picture_scrollview.setVisibility(View.VISIBLE);
- int i = 0 ;
- for(final Attachment attachment: attachments){
+ int i = 0;
+ for (final Attachment attachment : attachments) {
String url = attachment.getPreview_url();
- if( url == null || url.trim().equals(""))
+ if (url == null || url.trim().equals(""))
url = attachment.getUrl();
final ImageView imageView = new ImageView(getApplicationContext());
imageView.setId(Integer.parseInt(attachment.getId()));
@@ -3391,20 +3388,20 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
}
});
addBorder();
- if( attachments.size() < max_media_count)
+ if (attachments.size() < max_media_count)
toot_picture.setEnabled(true);
toot_sensitive.setVisibility(View.VISIBLE);
i++;
}
- }else {
+ } else {
toot_picture_container.setVisibility(View.GONE);
}
//Sensitive content
toot_sensitive.setChecked(status.isSensitive());
- if( status.getSpoiler_text() != null && status.getSpoiler_text().length() > 0 ){
+ if (status.getSpoiler_text() != null && status.getSpoiler_text().length() > 0) {
toot_cw_content.setText(status.getSpoiler_text());
toot_cw_content.setVisibility(View.VISIBLE);
- }else {
+ } else {
toot_cw_content.setText("");
toot_cw_content.setVisibility(View.GONE);
}
@@ -3412,7 +3409,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
toot_content.setText(content);
toot_space_left.setText(String.valueOf(countLength(social, toot_content, toot_cw_content)));
toot_content.setSelection(toot_content.getText().length());
- switch (status.getVisibility()){
+ switch (status.getVisibility()) {
case "public":
visibility = "public";
toot_visibility.setImageResource(R.drawable.ic_public_toot);
@@ -3431,60 +3428,58 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
break;
}
- if( title != null) {
+ if (title != null) {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
title.setText(getString(R.string.queet_title));
else
title.setText(getString(R.string.toot_title));
- }
- else {
+ } else {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
setTitle(R.string.queet_title);
else
setTitle(R.string.toot_title);
}
invalidateOptionsMenu();
- initialContent = displayWYSIWYG()?wysiwyg.getContentAsHTML():toot_content.getText().toString();
+ initialContent = displayWYSIWYG() ? wysiwyg.getContentAsHTML() : toot_content.getText().toString();
toot_space_left.setText(String.valueOf(countLength(social, toot_content, toot_cw_content)));
}
- private void tootReply(){
+ private void tootReply() {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
- if( title != null) {
+ if (title != null) {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
title.setText(getString(R.string.queet_title_reply));
else
title.setText(getString(R.string.toot_title_reply));
- }
- else {
+ } else {
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU)
setTitle(R.string.queet_title_reply);
else
setTitle(R.string.toot_title_reply);
}
String userIdReply;
- if( accountReply == null)
+ if (accountReply == null)
userIdReply = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
else
userIdReply = accountReply.getId();
//If toot is not restored
- if( restored == -1 ){
+ if (restored == -1) {
//Gets the default visibility, will be used if not set in settings
- String defaultVisibility = account.isLocked()?"private":"public";
+ String defaultVisibility = account.isLocked() ? "private" : "public";
String settingsVisibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility);
int initialTootVisibility = 0;
int ownerTootVisibility = 0;
String temp_visibility = tootReply.getVisibility();
- if( quickmessagevisibility != null){
+ if (quickmessagevisibility != null) {
temp_visibility = quickmessagevisibility;
}
- switch (temp_visibility){
+ switch (temp_visibility) {
case "public":
initialTootVisibility = 4;
break;
case "unlisted":
- initialTootVisibility = 3;
+ initialTootVisibility = 3;
break;
case "private":
visibility = "private";
@@ -3496,12 +3491,12 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
break;
}
if (settingsVisibility != null) {
- switch (settingsVisibility){
+ switch (settingsVisibility) {
case "public":
ownerTootVisibility = 4;
break;
case "unlisted":
- ownerTootVisibility = 3;
+ ownerTootVisibility = 3;
break;
case "private":
visibility = "private";
@@ -3514,12 +3509,12 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
}
}
int tootVisibility;
- if( ownerTootVisibility >= initialTootVisibility){
+ if (ownerTootVisibility >= initialTootVisibility) {
tootVisibility = initialTootVisibility;
- }else {
+ } else {
tootVisibility = ownerTootVisibility;
}
- switch (tootVisibility){
+ switch (tootVisibility) {
case 4:
visibility = "public";
toot_visibility.setImageResource(R.drawable.ic_public_toot);
@@ -3538,61 +3533,61 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
break;
}
- if( tootReply.getSpoiler_text() != null && tootReply.getSpoiler_text().length() > 0) {
+ if (tootReply.getSpoiler_text() != null && tootReply.getSpoiler_text().length() > 0) {
toot_cw_content.setText(tootReply.getSpoiler_text());
toot_cw_content.setVisibility(View.VISIBLE);
}
- if( tootReply != null) {
+ if (tootReply != null) {
manageMentions(getApplicationContext(), social, userIdReply, toot_content, toot_cw_content, toot_space_left, tootReply);
}
boolean forwardTags = sharedpreferences.getBoolean(Helper.SET_FORWARD_TAGS_IN_REPLY, false);
- if( tootReply != null && forwardTags && tootReply.getTags() != null && tootReply.getTags().size() > 0){
+ if (tootReply != null && forwardTags && tootReply.getTags() != null && tootReply.getTags().size() > 0) {
int currentCursorPosition = toot_content.getSelectionStart();
- toot_content.setText(toot_content.getText() +"\n");
- for(Tag tag: tootReply.getTags()){
- toot_content.setText(toot_content.getText() +" #"+tag.getName());
+ toot_content.setText(toot_content.getText() + "\n");
+ for (Tag tag : tootReply.getTags()) {
+ toot_content.setText(toot_content.getText() + " #" + tag.getName());
}
toot_content.setSelection(currentCursorPosition);
toot_space_left.setText(String.valueOf(countLength(social, toot_content, toot_cw_content)));
}
}
- initialContent = displayWYSIWYG()?wysiwyg.getContentAsHTML():toot_content.getText().toString();
+ initialContent = displayWYSIWYG() ? wysiwyg.getContentAsHTML() : toot_content.getText().toString();
}
- public static void manageMentions(Context context, UpdateAccountInfoAsyncTask.SOCIAL social, String userIdReply, MastalabAutoCompleteTextView contentView, EditText CWView, TextView counterView, Status tootReply){
+ public static void manageMentions(Context context, UpdateAccountInfoAsyncTask.SOCIAL social, String userIdReply, MastalabAutoCompleteTextView contentView, EditText CWView, TextView counterView, Status tootReply) {
//Retrieves mentioned accounts + OP and adds them at the beginin of the toot
ArrayList mentionedAccountsAdded = new ArrayList<>();
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int cursorReply = 0;
- if( tootReply.getAccount() != null && tootReply.getAccount().getAcct() != null && !tootReply.getAccount().getId().equals(userIdReply)) {
+ if (tootReply.getAccount() != null && tootReply.getAccount().getAcct() != null && !tootReply.getAccount().getId().equals(userIdReply)) {
contentView.setText(String.format("@%s", tootReply.getAccount().getAcct()));
mentionedAccountsAdded.add(tootReply.getAccount().getAcct());
//Evaluate the cursor position => mention length + 1 char for carriage return
cursorReply = contentView.getText().toString().length() + 1;
}
- if( tootReply.getMentions() != null ){
+ if (tootReply.getMentions() != null) {
//Put other accounts mentioned at the bottom
boolean capitalize = sharedpreferences.getBoolean(Helper.SET_CAPITALIZE, true);
- if( capitalize)
+ if (capitalize)
contentView.setText(String.format("%s", (contentView.getText().toString() + "\n\n")));
else
contentView.setText(String.format("%s", (contentView.getText().toString() + " ")));
- for(Mention mention : tootReply.getMentions()){
- if( mention.getAcct() != null && !mention.getId().equals(userIdReply) && !mentionedAccountsAdded.contains(mention.getAcct())) {
+ for (Mention mention : tootReply.getMentions()) {
+ if (mention.getAcct() != null && !mention.getId().equals(userIdReply) && !mentionedAccountsAdded.contains(mention.getAcct())) {
mentionedAccountsAdded.add(mention.getAcct());
String tootTemp = String.format("@%s ", mention.getAcct());
- contentView.setText(String.format("%s ", (contentView.getText().toString() + tootTemp.trim())));
+ contentView.setText(String.format("%s ", (contentView.getText().toString() + tootTemp.trim())));
}
}
contentView.setText(contentView.getText().toString().trim());
- if (contentView.getText().toString().startsWith("@") ) {
- if( capitalize )
+ if (contentView.getText().toString().startsWith("@")) {
+ if (capitalize)
contentView.append("\n");
else
contentView.append(" ");
@@ -3600,7 +3595,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
counterView.setText(String.valueOf(countLength(social, contentView, CWView)));
contentView.requestFocus();
- if( capitalize) {
+ if (capitalize) {
if (mentionedAccountsAdded.size() == 1) {
contentView.setSelection(contentView.getText().length()); //Put cursor at the end
} else {
@@ -3609,13 +3604,13 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
else
contentView.setSelection(contentView.getText().length()); //Put cursor at the end
}
- }else {
+ } else {
contentView.setSelection(contentView.getText().length()); //Put cursor at the end
}
}
}
- private void displayPollPopup(){
+ private void displayPollPopup() {
AlertDialog.Builder alertPoll = new AlertDialog.Builder(TootActivity.this, style);
alertPoll.setTitle(R.string.create_poll);
View view = getLayoutInflater().inflate(R.layout.popup_poll, null);
@@ -3631,11 +3626,11 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
int max_length = 25;
pollCountItem = 2;
remove.setVisibility(View.GONE);
- if( MainActivity.poll_limits != null && MainActivity.poll_limits.containsKey("max_options")){
- max_entry = MainActivity.poll_limits.get("max_options")!=null?MainActivity.poll_limits.get("max_options"):4;
+ if (MainActivity.poll_limits != null && MainActivity.poll_limits.containsKey("max_options")) {
+ max_entry = MainActivity.poll_limits.get("max_options") != null ? MainActivity.poll_limits.get("max_options") : 4;
}
- if( MainActivity.poll_limits != null && MainActivity.poll_limits.containsKey("max_option_chars")){
- max_length = MainActivity.poll_limits.get("max_option_chars")!=null?MainActivity.poll_limits.get("max_option_chars"):25;
+ if (MainActivity.poll_limits != null && MainActivity.poll_limits.containsKey("max_option_chars")) {
+ max_length = MainActivity.poll_limits.get("max_option_chars") != null ? MainActivity.poll_limits.get("max_option_chars") : 25;
}
InputFilter[] fArray = new InputFilter[1];
fArray[0] = new InputFilter.LengthFilter(max_length);
@@ -3647,18 +3642,18 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if( pollCountItem < finalMax_entry){
+ if (pollCountItem < finalMax_entry) {
EditText poll_item = new EditText(TootActivity.this);
InputFilter[] fArray = new InputFilter[1];
fArray[0] = new InputFilter.LengthFilter(finalMax_length);
poll_item.setFilters(fArray);
- poll_item.setHint(getString(R.string.poll_choice_s,(pollCountItem+1)));
+ poll_item.setHint(getString(R.string.poll_choice_s, (pollCountItem + 1)));
poll_items_container.addView(poll_item);
}
pollCountItem++;
- if( pollCountItem >= finalMax_entry){
+ if (pollCountItem >= finalMax_entry) {
add.setVisibility(View.GONE);
- }else{
+ } else {
add.setVisibility(View.VISIBLE);
}
remove.setVisibility(View.VISIBLE);
@@ -3667,14 +3662,14 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
remove.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if( pollCountItem > 2){
+ if (pollCountItem > 2) {
int childCount = poll_items_container.getChildCount();
- poll_items_container.removeViewAt(childCount -1);
+ poll_items_container.removeViewAt(childCount - 1);
}
pollCountItem--;
- if( pollCountItem <= 2){
+ if (pollCountItem <= 2) {
remove.setVisibility(View.GONE);
- }else{
+ } else {
remove.setVisibility(View.VISIBLE);
}
add.setVisibility(View.VISIBLE);
@@ -3690,22 +3685,22 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
poll_duration.setAdapter(pollduration);
poll_duration.setSelection(4);
poll_choice.setSelection(0);
- if( poll != null && poll.getOptionsList() != null){
+ if (poll != null && poll.getOptionsList() != null) {
int i = 1;
- for(PollOptions pollOptions: poll.getOptionsList()){
- if( i == 1){
- if( pollOptions.getTitle() != null)
+ for (PollOptions pollOptions : poll.getOptionsList()) {
+ if (i == 1) {
+ if (pollOptions.getTitle() != null)
choice_1.setText(pollOptions.getTitle());
- }else if(i == 2){
- if( pollOptions.getTitle() != null)
+ } else if (i == 2) {
+ if (pollOptions.getTitle() != null)
choice_2.setText(pollOptions.getTitle());
- }else{
+ } else {
EditText poll_item = new EditText(TootActivity.this);
fArray = new InputFilter[1];
fArray[0] = new InputFilter.LengthFilter(finalMax_length);
poll_item.setFilters(fArray);
- poll_item.setHint(getString(R.string.poll_choice_s,(pollCountItem+1)));
- if( pollOptions.getTitle() != null){
+ poll_item.setHint(getString(R.string.poll_choice_s, (pollCountItem + 1)));
+ if (pollOptions.getTitle() != null) {
poll_item.setText(pollOptions.getTitle());
}
poll_items_container.addView(poll_item);
@@ -3715,12 +3710,12 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
}
remove.setVisibility(View.VISIBLE);
add.setVisibility(View.VISIBLE);
- if(poll.getOptionsList().size() >= max_entry){
+ if (poll.getOptionsList().size() >= max_entry) {
add.setVisibility(View.GONE);
- }else if( poll.getOptionsList().size() <= 2 ){
+ } else if (poll.getOptionsList().size() <= 2) {
remove.setVisibility(View.GONE);
}
- switch (poll.getExpires_in()){
+ switch (poll.getExpires_in()) {
case 300:
poll_duration.setSelection(0);
break;
@@ -3743,7 +3738,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
poll_duration.setSelection(6);
break;
}
- if( poll.isMultiple())
+ if (poll.isMultiple())
poll_choice.setSelection(1);
else
poll_choice.setSelection(0);
@@ -3752,11 +3747,11 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
}
alertPoll.setNeutralButton(R.string.delete, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
- if( poll != null)
+ if (poll != null)
poll = null;
poll_action.setVisibility(View.GONE);
toot_picture.setVisibility(View.VISIBLE);
- if( attachments != null && attachments.size() > 0)
+ if (attachments != null && attachments.size() > 0)
picture_scrollview.setVisibility(View.VISIBLE);
dialog.dismiss();
}
@@ -3779,13 +3774,13 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
String choice1 = choice_1.getText().toString().trim();
String choice2 = choice_2.getText().toString().trim();
- if( choice1.isEmpty() && choice2.isEmpty()){
+ if (choice1.isEmpty() && choice2.isEmpty()) {
Toasty.error(getApplicationContext(), getString(R.string.poll_invalid_choices), Toast.LENGTH_SHORT).show();
- }else{
+ } else {
poll = new Poll();
poll.setMultiple(poll_choice_pos != 0);
int expire = 0;
- switch (poll_duration_pos){
+ switch (poll_duration_pos) {
case 0:
expire = 300;
break;
@@ -3822,31 +3817,31 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
pollOptions.add(pollOption2);
int childCount = poll_items_container.getChildCount();
- if( childCount > 2){
- for( int i = 2 ; i < childCount; i++){
+ if (childCount > 2) {
+ for (int i = 2; i < childCount; i++) {
PollOptions pollItem = new PollOptions();
- pollItem.setTitle(((EditText)poll_items_container.getChildAt(i)).getText().toString());
+ pollItem.setTitle(((EditText) poll_items_container.getChildAt(i)).getText().toString());
pollOptions.add(pollItem);
}
}
List options = new ArrayList<>();
boolean doubleTitle = false;
- for(PollOptions po: pollOptions){
- if( !options.contains(po.getTitle().trim())){
+ for (PollOptions po : pollOptions) {
+ if (!options.contains(po.getTitle().trim())) {
options.add(po.getTitle().trim());
- }else{
+ } else {
doubleTitle = true;
}
}
- if( !doubleTitle) {
+ if (!doubleTitle) {
poll.setOptionsList(pollOptions);
dialog.dismiss();
- }else {
+ } else {
Toasty.error(getApplicationContext(), getString(R.string.poll_duplicated_entry), Toast.LENGTH_SHORT).show();
}
}
poll_action.setVisibility(View.VISIBLE);
- if(social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
+ if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
toot_picture.setVisibility(View.GONE);
picture_scrollview.setVisibility(View.GONE);
}
@@ -3858,15 +3853,15 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
alertPollDiaslog.show();
}
- private void storeToot(boolean message, boolean forced){
+ private void storeToot(boolean message, boolean forced) {
//Nothing to store here....
String currentContent;
- if( displayWYSIWYG()){
+ if (displayWYSIWYG()) {
currentContent = wysiwyg.getContentAsHTML().trim();
- }else{
+ } else {
currentContent = toot_content.getText().toString().trim();
}
- if( !forced) {
+ if (!forced) {
if (currentContent.length() == 0 && (attachments == null || attachments.size() < 1) && toot_cw_content.getText().toString().trim().length() == 0)
return;
if (initialContent.trim().equals(currentContent))
@@ -3875,39 +3870,40 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
Status toot = new Status();
toot.setSensitive(isSensitive);
toot.setMedia_attachments(attachments);
- if( toot_cw_content.getText().toString().trim().length() > 0)
+ if (toot_cw_content.getText().toString().trim().length() > 0)
toot.setSpoiler_text(toot_cw_content.getText().toString().trim());
toot.setVisibility(visibility);
toot.setContent(currentContent);
- if( poll != null)
+ if (poll != null)
toot.setPoll(poll);
- if( tootReply != null)
+ if (tootReply != null)
toot.setIn_reply_to_id(tootReply.getId());
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
- try{
- if( currentToId == -1 ) {
+ try {
+ if (currentToId == -1) {
currentToId = new StatusStoredDAO(TootActivity.this, db).insertStatus(toot, tootReply);
- }else{
+ } else {
StoredStatus storedStatus = new StatusStoredDAO(TootActivity.this, db).getStatus(currentToId);
- if( storedStatus != null ){
+ if (storedStatus != null) {
new StatusStoredDAO(TootActivity.this, db).updateStatus(currentToId, toot);
- }else { //Might have been deleted, so it needs insertion
+ } else { //Might have been deleted, so it needs insertion
new StatusStoredDAO(TootActivity.this, db).insertStatus(toot, tootReply);
}
}
- if( message )
+ if (message)
Toasty.success(getApplicationContext(), getString(R.string.toast_toot_saved), Toast.LENGTH_LONG).show();
- }catch (Exception e){
- if( message)
+ } catch (Exception e) {
+ if (message)
Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
}
}
- private void changeColor(){
+
+ private void changeColor() {
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
- if( theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK) {
+ if (theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK) {
changeDrawableColor(TootActivity.this, R.drawable.ic_public_toot, R.color.dark_text);
changeDrawableColor(TootActivity.this, R.drawable.ic_lock_open_toot, R.color.dark_text);
changeDrawableColor(TootActivity.this, R.drawable.ic_lock_outline_toot, R.color.dark_text);
@@ -3924,7 +3920,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
changeDrawableColor(TootActivity.this, findViewById(R.id.toot_emoji), R.color.dark_text);
Helper.changeButtonTextColor(TootActivity.this, findViewById(R.id.toot_cw), R.color.dark_text);
- }else {
+ } else {
changeDrawableColor(TootActivity.this, R.drawable.ic_public_toot, R.color.white);
changeDrawableColor(TootActivity.this, R.drawable.ic_lock_open_toot, R.color.white);
changeDrawableColor(TootActivity.this, R.drawable.ic_lock_outline_toot, R.color.white);
@@ -3949,7 +3945,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
public void onRetrieveAccountsReply(ArrayList accounts) {
final boolean[] checkedValues = new boolean[accounts.size()];
int i = 0;
- for(Account account: accounts) {
+ for (Account account : accounts) {
checkedValues[i] = toot_content.getText().toString().contains("@" + account.getAcct());
i++;
}
@@ -3966,12 +3962,12 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
builderSingle.show();
}
- public void changeAccountReply(boolean isChecked, String acct){
+ public void changeAccountReply(boolean isChecked, String acct) {
if (isChecked) {
- if( !toot_content.getText().toString().contains(acct))
- toot_content.setText(String.format("%s %s",acct, toot_content.getText()));
+ if (!toot_content.getText().toString().contains(acct))
+ toot_content.setText(String.format("%s %s", acct, toot_content.getText()));
} else {
- toot_content.setText(toot_content.getText().toString().replaceAll("\\s*" +acct, ""));
+ toot_content.setText(toot_content.getText().toString().replaceAll("\\s*" + acct, ""));
}
}
@@ -3987,21 +3983,21 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
active = false;
}
- private void addBorder(){
+ private void addBorder() {
for (int i = 0; i < toot_picture_container.getChildCount(); i++) {
View v = toot_picture_container.getChildAt(i);
if (v instanceof ImageView) {
- for(Attachment attachment: attachments){
- if(attachment.getType().toLowerCase().equals("image"))
- if( v.getTag().toString().trim().equals(attachment.getId().trim())){
- int borderSize = (int) Helper.convertDpToPixel(1, TootActivity.this);
- int borderSizeTop = (int) Helper.convertDpToPixel(6, TootActivity.this);
- v.setPadding(borderSize,borderSizeTop,borderSize,borderSizeTop);
- if( attachment.getDescription() == null ||attachment.getDescription().trim().equals("null") || attachment.getDescription().trim().equals("")) {
- v.setBackgroundColor( ContextCompat.getColor(TootActivity.this, R.color.red_1));
- }else
- v.setBackgroundColor(ContextCompat.getColor(TootActivity.this, R.color.green_1));
- }
+ for (Attachment attachment : attachments) {
+ if (attachment.getType().toLowerCase().equals("image"))
+ if (v.getTag().toString().trim().equals(attachment.getId().trim())) {
+ int borderSize = (int) Helper.convertDpToPixel(1, TootActivity.this);
+ int borderSizeTop = (int) Helper.convertDpToPixel(6, TootActivity.this);
+ v.setPadding(borderSize, borderSizeTop, borderSize, borderSizeTop);
+ if (attachment.getDescription() == null || attachment.getDescription().trim().equals("null") || attachment.getDescription().trim().equals("")) {
+ v.setBackgroundColor(ContextCompat.getColor(TootActivity.this, R.color.red_1));
+ } else
+ v.setBackgroundColor(ContextCompat.getColor(TootActivity.this, R.color.green_1));
+ }
}
}
@@ -4010,19 +4006,19 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
}
- public static int countLength(UpdateAccountInfoAsyncTask.SOCIAL social, MastalabAutoCompleteTextView toot_content, EditText toot_cw_content){
- if( toot_content == null || toot_cw_content == null) {
+ public static int countLength(UpdateAccountInfoAsyncTask.SOCIAL social, MastalabAutoCompleteTextView toot_content, EditText toot_cw_content) {
+ if (toot_content == null || toot_cw_content == null) {
return -1;
}
String content = toot_content.getText().toString();
String cwContent = toot_cw_content.getText().toString();
String contentCount = content;
- if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON ){
- contentCount = contentCount.replaceAll("(^|[^/\\w])@(([a-z0-9_]+)@[a-z0-9\\.\\-]+[a-z0-9]+)","$1@$3");
+ if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
+ contentCount = contentCount.replaceAll("(^|[^/\\w])@(([a-z0-9_]+)@[a-z0-9\\.\\-]+[a-z0-9]+)", "$1@$3");
Matcher matcherALink = Patterns.WEB_URL.matcher(contentCount);
- while (matcherALink.find()){
+ while (matcherALink.find()) {
final String url = matcherALink.group(1);
- contentCount = contentCount.replace(url,"abcdefghijklmnopkrstuvw");
+ contentCount = contentCount.replace(url, "abcdefghijklmnopkrstuvw");
}
}
@@ -4031,8 +4027,8 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
return cwLength + contentLength;
}
- int countLength(Editor wysiwyg, EditText toot_cw_content){
- if( wysiwyg == null || toot_cw_content == null) {
+ int countLength(Editor wysiwyg, EditText toot_cw_content) {
+ if (wysiwyg == null || toot_cw_content == null) {
return -1;
}
String content = wysiwyg.getContentAsHTML();
@@ -4042,7 +4038,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
return cwLength + contentLength;
}
- private void recordAudio(){
+ private void recordAudio() {
String filePath = getCacheDir() + "/fedilab_recorded_audio.wav";
int color = getResources().getColor(R.color.mastodonC1);
AndroidAudioRecorder.with(this)
@@ -4062,15 +4058,15 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
}
- private boolean displayWYSIWYG(){
- if( social != UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA){
+ private boolean displayWYSIWYG() {
+ if (social != UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
return false;
}
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
return sharedpreferences.getBoolean(Helper.SET_WYSIWYG, false);
}
- private void renderEditor(){
+ private void renderEditor() {
findViewById(R.id.action_h1).setOnClickListener(new View.OnClickListener() {
diff --git a/app/src/main/java/app/fedilab/android/activities/TootInfoActivity.java b/app/src/main/java/app/fedilab/android/activities/TootInfoActivity.java
index 0f9b76282..d32fed93b 100644
--- a/app/src/main/java/app/fedilab/android/activities/TootInfoActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/TootInfoActivity.java
@@ -17,12 +17,15 @@ package app.fedilab.android.activities;
import android.content.SharedPreferences;
import android.os.Bundle;
+
import com.google.android.material.tabs.TabLayout;
+
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
+
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Toast;
@@ -55,7 +58,7 @@ public class TootInfoActivity extends BaseActivity {
requestWindowFeature(Window.FEATURE_NO_TITLE);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
- switch (theme){
+ switch (theme) {
case Helper.THEME_LIGHT:
setTheme(R.style.AppTheme);
break;
@@ -71,24 +74,24 @@ public class TootInfoActivity extends BaseActivity {
setContentView(R.layout.activity_toot_info);
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
Bundle b = getIntent().getExtras();
- if( getSupportActionBar() != null)
+ if (getSupportActionBar() != null)
getSupportActionBar().hide();
int toot_reblogs_count = 0;
int toot_favorites_count = 0;
- if( b != null){
+ if (b != null) {
toot_id = b.getString("toot_id", null);
toot_reblogs_count = b.getInt("toot_reblogs_count", 0);
toot_favorites_count = b.getInt("toot_favorites_count", 0);
}
- if( toot_id == null){
+ if (toot_id == null) {
Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_SHORT).show();
finish();
}
userID = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
tabLayout = findViewById(R.id.tabLayout);
mPager = findViewById(R.id.viewpager);
- tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.reblog) + " ("+toot_reblogs_count+")"));
- tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.favourite) + " ("+toot_favorites_count+")"));
+ tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.reblog) + " (" + toot_reblogs_count + ")"));
+ tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.favourite) + " (" + toot_favorites_count + ")"));
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@@ -96,6 +99,7 @@ public class TootInfoActivity extends BaseActivity {
public void onTabSelected(TabLayout.Tab tab) {
mPager.setCurrentItem(tab.getPosition());
}
+
@Override
public void onTabUnselected(TabLayout.Tab tab) {
@@ -118,7 +122,7 @@ public class TootInfoActivity extends BaseActivity {
@Override
public void onPageSelected(int position) {
TabLayout.Tab tab = tabLayout.getTabAt(position);
- if( tab != null)
+ if (tab != null)
tab.select();
}
@@ -130,12 +134,12 @@ public class TootInfoActivity extends BaseActivity {
}
- public void updateBoostCount(int count){
- Objects.requireNonNull(tabLayout.getTabAt(0)).setText(getString(R.string.reblog) + " ("+count+")");
+ public void updateBoostCount(int count) {
+ Objects.requireNonNull(tabLayout.getTabAt(0)).setText(getString(R.string.reblog) + " (" + count + ")");
}
- public void updateFavCount(int count){
- Objects.requireNonNull(tabLayout.getTabAt(1)).setText(getString(R.string.favourite) + " ("+count+")");
+ public void updateFavCount(int count) {
+ Objects.requireNonNull(tabLayout.getTabAt(1)).setText(getString(R.string.favourite) + " (" + count + ")");
}
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
@@ -147,7 +151,7 @@ public class TootInfoActivity extends BaseActivity {
@Override
public Fragment getItem(int position) {
Bundle bundle = new Bundle();
- switch (position){
+ switch (position) {
case 0:
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.REBLOGGED);
diff --git a/app/src/main/java/app/fedilab/android/activities/WebviewActivity.java b/app/src/main/java/app/fedilab/android/activities/WebviewActivity.java
index 551932969..fe9ec7ca2 100644
--- a/app/src/main/java/app/fedilab/android/activities/WebviewActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/WebviewActivity.java
@@ -29,9 +29,11 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
+
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AlertDialog;
+
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -80,7 +82,7 @@ public class WebviewActivity extends BaseActivity {
super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
- switch (theme){
+ switch (theme) {
case Helper.THEME_LIGHT:
setTheme(R.style.AppTheme);
break;
@@ -97,14 +99,14 @@ public class WebviewActivity extends BaseActivity {
setContentView(R.layout.activity_webview);
Bundle b = getIntent().getExtras();
- if(b != null) {
+ if (b != null) {
url = b.getString("url", null);
peertubeLinkToFetch = b.getString("peertubeLinkToFetch", null);
- peertubeLink = b.getBoolean("peertubeLink", false);
+ peertubeLink = b.getBoolean("peertubeLink", false);
}
- if( url == null)
+ if (url == null)
finish();
- if( getSupportActionBar() != null)
+ if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
webView = Helper.initializeWebview(WebviewActivity.this, R.id.webview);
@@ -115,13 +117,13 @@ public class WebviewActivity extends BaseActivity {
boolean proxyEnabled = sharedpreferences.getBoolean(Helper.SET_PROXY_ENABLED, false);
- if( proxyEnabled ){
+ if (proxyEnabled) {
String host = sharedpreferences.getString(Helper.SET_PROXY_HOST, "127.0.0.1");
int port = sharedpreferences.getInt(Helper.SET_PROXY_PORT, 8118);
- ProxyHelper.setProxy(getApplicationContext(), webView,host, port,WebviewActivity.class.getName());
+ ProxyHelper.setProxy(getApplicationContext(), webView, host, port, WebviewActivity.class.getName());
}
- MastalabWebChromeClient mastalabWebChromeClient = new MastalabWebChromeClient(WebviewActivity.this, webView, webview_container, videoLayout);
+ MastalabWebChromeClient mastalabWebChromeClient = new MastalabWebChromeClient(WebviewActivity.this, webView, webview_container, videoLayout);
mastalabWebChromeClient.setOnToggledFullscreen(new MastalabWebChromeClient.ToggledFullscreenCallback() {
@Override
public void toggledFullscreen(boolean fullscreen) {
@@ -150,26 +152,26 @@ public class WebviewActivity extends BaseActivity {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
- if(Build.VERSION.SDK_INT >= 23 ){
+ if (Build.VERSION.SDK_INT >= 23) {
if (ContextCompat.checkSelfPermission(WebviewActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(WebviewActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(WebviewActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, Helper.EXTERNAL_STORAGE_REQUEST_CODE);
} else {
Helper.manageDownloads(WebviewActivity.this, url);
}
- }else{
+ } else {
Helper.manageDownloads(WebviewActivity.this, url);
}
}
});
- if( !url.startsWith("http://") && !url.startsWith("https://"))
+ if (!url.startsWith("http://") && !url.startsWith("https://"))
url = "http://" + url;
- if( trackingDomains == null){
+ if (trackingDomains == null) {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
SQLiteDatabase db = Sqlite.getInstance(WebviewActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
trackingDomains = new DomainBlockDAO(WebviewActivity.this, db).getAll();
- if( trackingDomains == null)
+ if (trackingDomains == null)
trackingDomains = new ArrayList<>();
// Get a handler that can be used to post to the main thread
Handler mainHandler = new Handler(getMainLooper());
@@ -183,13 +185,13 @@ public class WebviewActivity extends BaseActivity {
}
});
- }else
+ } else
webView.loadUrl(url);
}
public void setCount(Context context, String count) {
- if( defaultMenu != null && !peertubeLink) {
+ if (defaultMenu != null && !peertubeLink) {
MenuItem menuItem = defaultMenu.findItem(R.id.action_block);
LayerDrawable icon = (LayerDrawable) menuItem.getIcon();
@@ -211,7 +213,7 @@ public class WebviewActivity extends BaseActivity {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
- if(!peertubeLink)
+ if (!peertubeLink)
setCount(this, "0");
defaultMenu = menu;
return super.onPrepareOptionsMenu(menu);
@@ -221,17 +223,18 @@ public class WebviewActivity extends BaseActivity {
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_webview, menu);
defaultMenu = menu;
- if( peertubeLink ){
+ if (peertubeLink) {
menu.findItem(R.id.action_go).setVisible(false);
menu.findItem(R.id.action_block).setVisible(false);
menu.findItem(R.id.action_comment).setVisible(true);
}
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
- if( theme == Helper.THEME_LIGHT)
+ if (theme == Helper.THEME_LIGHT)
Helper.colorizeIconMenu(menu, R.color.black);
return true;
}
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
@@ -249,9 +252,9 @@ public class WebviewActivity extends BaseActivity {
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
- } else if (theme == Helper.THEME_BLACK){
+ } else if (theme == Helper.THEME_BLACK) {
style = R.style.DialogBlack;
- }else {
+ } else {
style = R.style.Dialog;
}
AlertDialog.Builder builder = new AlertDialog.Builder(WebviewActivity.this, style);
@@ -279,8 +282,8 @@ public class WebviewActivity extends BaseActivity {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
try {
startActivity(browserIntent);
- }catch (Exception e){
- Toasty.error(getApplicationContext(),getString(R.string.toast_error),Toast.LENGTH_LONG).show();
+ } catch (Exception e) {
+ Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
}
return true;
case R.id.action_comment:
@@ -293,7 +296,7 @@ public class WebviewActivity extends BaseActivity {
@Override
protected Void doInBackground(Void... voids) {
- if(url != null) {
+ if (url != null) {
APIResponse search = new API(contextReference.get()).search(peertubeLinkToFetch);
if (search != null && search.getResults() != null) {
remoteStatuses = search.getResults().getStatuses();
@@ -306,46 +309,46 @@ public class WebviewActivity extends BaseActivity {
protected void onPostExecute(Void result) {
Intent intent = new Intent(contextReference.get(), TootActivity.class);
Bundle b = new Bundle();
- if( remoteStatuses == null || remoteStatuses.size() == 0){
- Toasty.error(contextReference.get(),getString(R.string.toast_error),Toast.LENGTH_LONG).show();
+ if (remoteStatuses == null || remoteStatuses.size() == 0) {
+ Toasty.error(contextReference.get(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
return;
}
- if( remoteStatuses.get(0).getReblog() != null ) {
+ if (remoteStatuses.get(0).getReblog() != null) {
b.putParcelable("tootReply", remoteStatuses.get(0).getReblog());
- }else {
+ } else {
b.putParcelable("tootReply", remoteStatuses.get(0));
}
intent.putExtras(b); //Put your id to your next Intent
contextReference.get().startActivity(intent);
}
- }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR );
+ }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
- public void setUrl(String newUrl){
+ public void setUrl(String newUrl) {
this.url = newUrl;
}
@Override
- public void onPause(){
+ public void onPause() {
super.onPause();
- if( webView != null)
+ if (webView != null)
webView.onPause();
}
@Override
- public void onResume(){
+ public void onResume() {
super.onResume();
- if( webView != null)
+ if (webView != null)
webView.onResume();
}
@Override
public void onBackPressed() {
- if (webView.canGoBack()){
+ if (webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
@@ -353,9 +356,9 @@ public class WebviewActivity extends BaseActivity {
}
@Override
- public void onDestroy(){
+ public void onDestroy() {
super.onDestroy();
- if( webView != null)
+ if (webView != null)
webView.destroy();
}
}
diff --git a/app/src/main/java/app/fedilab/android/activities/WebviewConnectActivity.java b/app/src/main/java/app/fedilab/android/activities/WebviewConnectActivity.java
index b2d1c9cda..962a3a60b 100644
--- a/app/src/main/java/app/fedilab/android/activities/WebviewConnectActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/WebviewConnectActivity.java
@@ -23,9 +23,11 @@ import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
+
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
+
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -69,7 +71,7 @@ public class WebviewConnectActivity extends BaseActivity {
super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
- switch (theme){
+ switch (theme) {
case Helper.THEME_LIGHT:
setTheme(R.style.AppTheme);
break;
@@ -85,19 +87,19 @@ public class WebviewConnectActivity extends BaseActivity {
setContentView(R.layout.activity_webview_connect);
Bundle b = getIntent().getExtras();
- if(b != null) {
+ if (b != null) {
instance = b.getString("instance");
social = (UpdateAccountInfoAsyncTask.SOCIAL) b.getSerializable("social");
}
- if( instance == null)
+ if (instance == null)
finish();
clientId = sharedpreferences.getString(Helper.CLIENT_ID, null);
clientSecret = sharedpreferences.getString(Helper.CLIENT_SECRET, null);
ActionBar actionBar = getSupportActionBar();
- if( actionBar != null ) {
+ if (actionBar != null) {
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
assert inflater != null;
- View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(getApplicationContext()), false);
+ View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(getApplicationContext()), false);
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
@@ -109,7 +111,7 @@ public class WebviewConnectActivity extends BaseActivity {
}
});
toolbar_title.setText(R.string.add_account);
- if (theme == Helper.THEME_LIGHT){
+ if (theme == Helper.THEME_LIGHT) {
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
Helper.colorizeToolbar(toolbar, R.color.black, WebviewConnectActivity.this);
}
@@ -139,20 +141,20 @@ public class WebviewConnectActivity extends BaseActivity {
});
boolean proxyEnabled = sharedpreferences.getBoolean(Helper.SET_PROXY_ENABLED, false);
- if( proxyEnabled ){
+ if (proxyEnabled) {
String host = sharedpreferences.getString(Helper.SET_PROXY_HOST, "127.0.0.1");
int port = sharedpreferences.getInt(Helper.SET_PROXY_PORT, 8118);
- ProxyHelper.setProxy(getApplicationContext(), webView,host, port,WebviewConnectActivity.class.getName());
+ ProxyHelper.setProxy(getApplicationContext(), webView, host, port, WebviewConnectActivity.class.getName());
}
webView.setWebViewClient(new WebViewClient() {
@SuppressWarnings("deprecation")
@Override
- public boolean shouldOverrideUrlLoading(WebView view, String url){
- super.shouldOverrideUrlLoading(view,url);
- if( url.contains(Helper.REDIRECT_CONTENT_WEB)){
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ super.shouldOverrideUrlLoading(view, url);
+ if (url.contains(Helper.REDIRECT_CONTENT_WEB)) {
String val[] = url.split("code=");
- if (val.length< 2){
+ if (val.length < 2) {
Toasty.error(getApplicationContext(), getString(R.string.toast_code_error), Toast.LENGTH_LONG).show();
Intent myIntent = new Intent(WebviewConnectActivity.this, LoginActivity.class);
startActivity(myIntent);
@@ -164,10 +166,10 @@ public class WebviewConnectActivity extends BaseActivity {
final HashMap parameters = new HashMap<>();
parameters.put(Helper.CLIENT_ID, clientId);
parameters.put(Helper.CLIENT_SECRET, clientSecret);
- parameters.put(Helper.REDIRECT_URI,Helper.REDIRECT_CONTENT_WEB);
+ parameters.put(Helper.REDIRECT_URI, Helper.REDIRECT_CONTENT_WEB);
parameters.put("grant_type", "authorization_code");
- parameters.put("code",code);
- new Thread(new Runnable(){
+ parameters.put("code", code);
+ new Thread(new Runnable() {
@Override
public void run() {
try {
@@ -177,7 +179,7 @@ public class WebviewConnectActivity extends BaseActivity {
resobj = new JSONObject(response);
String token = resobj.get("access_token").toString();
String refresh_token = null;
- if( resobj.has("refresh_token"))
+ if (resobj.has("refresh_token"))
refresh_token = resobj.get("refresh_token").toString();
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
@@ -185,9 +187,12 @@ public class WebviewConnectActivity extends BaseActivity {
editor.apply();
//Update the account with the token;
new UpdateAccountInfoAsyncTask(WebviewConnectActivity.this, token, clientId, clientSecret, refresh_token, instance, social).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- } catch (JSONException ignored) {}
- } catch (Exception ignored) {}
- }}).start();
+ } catch (JSONException ignored) {
+ }
+ } catch (Exception ignored) {
+ }
+ }
+ }).start();
return true;
}
return false;
@@ -208,8 +213,6 @@ public class WebviewConnectActivity extends BaseActivity {
}
-
-
@Override
public void onDestroy() {
super.onDestroy();
@@ -220,16 +223,15 @@ public class WebviewConnectActivity extends BaseActivity {
}
@SuppressWarnings("deprecation")
- public static void clearCookies(Context context)
- {
+ public static void clearCookies(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().flush();
} else {
- CookieSyncManager cookieSyncMngr=CookieSyncManager.createInstance(context);
+ CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context);
cookieSyncMngr.startSync();
- CookieManager cookieManager=CookieManager.getInstance();
+ CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookie();
cookieManager.removeSessionCookie();
cookieSyncMngr.stopSync();
diff --git a/app/src/main/java/app/fedilab/android/activities/WhoToFollowActivity.java b/app/src/main/java/app/fedilab/android/activities/WhoToFollowActivity.java
index 5c5307df6..0569e88c8 100644
--- a/app/src/main/java/app/fedilab/android/activities/WhoToFollowActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/WhoToFollowActivity.java
@@ -19,8 +19,10 @@ import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
+
import androidx.core.content.ContextCompat;
import androidx.appcompat.widget.Toolbar;
+
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
@@ -59,7 +61,6 @@ import app.fedilab.android.interfaces.OnRetrieveWhoToFollowInterface;
public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoToFollowInterface, OnPostActionInterface, OnListActionInterface {
-
private String item;
private List followedId;
private List accountListId;
@@ -75,7 +76,7 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
- switch (theme){
+ switch (theme) {
case Helper.THEME_LIGHT:
setTheme(R.style.AppTheme_NoActionBar_Fedilab);
break;
@@ -92,30 +93,30 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
no_action = findViewById(R.id.no_action);
Toolbar toolbar = findViewById(R.id.toolbar);
progess_action = findViewById(R.id.progess_action);
- if( theme == Helper.THEME_BLACK)
+ if (theme == Helper.THEME_BLACK)
toolbar.setBackgroundColor(ContextCompat.getColor(WhoToFollowActivity.this, R.color.black));
setSupportActionBar(toolbar);
- if( getSupportActionBar() != null)
+ if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mainLoader = findViewById(R.id.loader);
Bundle b = getIntent().getExtras();
- if(b != null){
+ if (b != null) {
item = b.getString("item");
}
followedId = new ArrayList<>();
- String lastDateListNameRefresh = sharedpreferences.getString(Helper.LAST_DATE_LIST_NAME_REFRESH+item, null);
+ String lastDateListNameRefresh = sharedpreferences.getString(Helper.LAST_DATE_LIST_NAME_REFRESH + item, null);
Calendar cal = Calendar.getInstance();
- cal.setTime(new Date( ));
+ cal.setTime(new Date());
cal.add(Calendar.MINUTE, -5);
Date dateAllowed = cal.getTime();
- if( lastDateListNameRefresh == null || Helper.stringToDate(WhoToFollowActivity.this, lastDateListNameRefresh).before(dateAllowed)) {
+ if (lastDateListNameRefresh == null || Helper.stringToDate(WhoToFollowActivity.this, lastDateListNameRefresh).before(dateAllowed)) {
new WhoToFollowAsyncTask(WhoToFollowActivity.this, item, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
mainLoader.setVisibility(View.VISIBLE);
- }else {
+ } else {
String lastList = sharedpreferences.getString(Helper.LAST_LIST_NAME + item, null);
List acctString = Helper.restoreArrayFromString(lastList);
- if( acctString != null) {
+ if (acctString != null) {
trunkAccounts = new ArrayList<>();
for (String acct : acctString) {
TrunkAccount trunkAccount = new TrunkAccount();
@@ -129,19 +130,19 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
}
- private void displayResults(){
+ private void displayResults() {
mainLoader.setVisibility(View.GONE);
WhoToFollowAccountsAdapter whoToFollowAccountsAdapter;
- if( trunkAccounts != null){
- if( trunkAccounts.size() > 0) {
+ if (trunkAccounts != null) {
+ if (trunkAccounts.size() > 0) {
ListView lv_list = findViewById(R.id.lv_list);
whoToFollowAccountsAdapter = new WhoToFollowAccountsAdapter(trunkAccounts);
lv_list.setAdapter(whoToFollowAccountsAdapter);
- }else {
+ } else {
no_action.setVisibility(View.VISIBLE);
return;
}
- }else{
+ } else {
Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_SHORT).show();
return;
}
@@ -150,15 +151,15 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
follow_accounts_select.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if(follow_accounts_select.getText().equals(getString(R.string.select_all))){
+ if (follow_accounts_select.getText().equals(getString(R.string.select_all))) {
follow_accounts_select.setText(R.string.unselect_all);
- for(TrunkAccount trunkAccount: trunkAccounts){
+ for (TrunkAccount trunkAccount : trunkAccounts) {
trunkAccount.setChecked(true);
}
whoToFollowAccountsAdapter.notifyDataSetChanged();
- }else {
+ } else {
follow_accounts_select.setText(R.string.select_all);
- for(TrunkAccount trunkAccount: trunkAccounts){
+ for (TrunkAccount trunkAccount : trunkAccounts) {
trunkAccount.setChecked(false);
}
whoToFollowAccountsAdapter.notifyDataSetChanged();
@@ -173,21 +174,21 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
follow_accounts_select.setEnabled(false);
progess_action.setVisibility(View.VISIBLE);
toFollowdId = new ArrayList<>();
- for(TrunkAccount trunkAccount: trunkAccounts){
- if( trunkAccount.isChecked()){
+ for (TrunkAccount trunkAccount : trunkAccounts) {
+ if (trunkAccount.isChecked()) {
toFollowdId.add(trunkAccount.getAcct());
}
}
- if(toFollowdId.size() > 0){
+ if (toFollowdId.size() > 0) {
Account account = new Account();
String[] val = toFollowdId.get(0).split("@");
progess_action.setText(getString(R.string.follow_trunk, toFollowdId.get(0)));
- if( val.length > 1){
+ if (val.length > 1) {
account.setAcct(val[0]);
account.setInstance(val[1]);
new PostActionAsyncTask(WhoToFollowActivity.this, null, account, API.StatusAction.FOLLOW, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- }else {
- Toasty.error(getApplicationContext(),getString(R.string.toast_impossible_to_follow), Toast.LENGTH_LONG).show();
+ } else {
+ Toasty.error(getApplicationContext(), getString(R.string.toast_impossible_to_follow), Toast.LENGTH_LONG).show();
follow_accounts.setEnabled(true);
follow_accounts_select.setEnabled(true);
progess_action.setVisibility(View.GONE);
@@ -216,12 +217,12 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
@Override
public void onRetrieveWhoToFollowAccount(List trunkAccounts) {
- if( trunkAccounts != null){
+ if (trunkAccounts != null) {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.LAST_DATE_LIST_NAME_REFRESH + item, Helper.dateToString(new Date()));
List accounts = new ArrayList<>();
- for(TrunkAccount trunkAccount: trunkAccounts)
+ for (TrunkAccount trunkAccount : trunkAccounts)
accounts.add(trunkAccount.getAcct());
editor.putString(Helper.LAST_LIST_NAME + item, Helper.arrayToStringStorage(accounts));
editor.apply();
@@ -233,14 +234,14 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
@Override
public void onPostAction(int statusCode, API.StatusAction statusAction, String userId, Error error) {
followedId.add(userId);
- if( followedId != null && followedId.size() >= toFollowdId.size()) {
+ if (followedId != null && followedId.size() >= toFollowdId.size()) {
progess_action.setText(getString(R.string.create_list_trunk, item));
new ManageListsAsyncTask(WhoToFollowActivity.this, ManageListsAsyncTask.action.CREATE_LIST, null, null, null, item, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- }else {
+ } else {
Account account = new Account();
String[] val = toFollowdId.get(followedId.size()).split("@");
progess_action.setText(getString(R.string.follow_trunk, toFollowdId.get(followedId.size())));
- if( val.length > 1){
+ if (val.length > 1) {
account.setAcct(val[0]);
account.setInstance(val[1]);
new PostActionAsyncTask(WhoToFollowActivity.this, null, account, API.StatusAction.FOLLOW, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -253,16 +254,16 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
public void onActionDone(ManageListsAsyncTask.action actionType, APIResponse apiResponse, int statusCode) {
List lists = apiResponse.getLists();
- if( lists!= null && lists.size() > 0 && actionType == ManageListsAsyncTask.action.CREATE_LIST){
+ if (lists != null && lists.size() > 0 && actionType == ManageListsAsyncTask.action.CREATE_LIST) {
String[] accountsId = followedId.toArray(new String[0]);
progess_action.setText(R.string.add_account_list_trunk);
listId = lists.get(0).getId();
listTitle = lists.get(0).getTitle();
new ManageListsAsyncTask(WhoToFollowActivity.this, ManageListsAsyncTask.action.ADD_USERS, new String[]{followedId.get(0)}, null, lists.get(0).getId(), null, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
accountListId = new ArrayList<>();
- }else if(accountListId != null){
+ } else if (accountListId != null) {
- if( accountListId.size() >= followedId.size() -1) {
+ if (accountListId.size() >= followedId.size() - 1) {
progess_action.setText(R.string.account_added_list_trunk);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@@ -274,12 +275,12 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
b.putString("title", listTitle);
intent.putExtras(b);
startActivity(intent);
- finish();
+ finish();
}
}, 1000);
- }else {
+ } else {
accountListId.add(followedId.get(accountListId.size()));
progess_action.setText(R.string.adding_account_list_trunk);
String userIdToAdd = followedId.get(accountListId.size());
diff --git a/app/src/main/java/app/fedilab/android/animatemenu/model/SlideMenuItem.java b/app/src/main/java/app/fedilab/android/animatemenu/model/SlideMenuItem.java
index 805517c16..443a43e59 100644
--- a/app/src/main/java/app/fedilab/android/animatemenu/model/SlideMenuItem.java
+++ b/app/src/main/java/app/fedilab/android/animatemenu/model/SlideMenuItem.java
@@ -24,7 +24,7 @@ public class SlideMenuItem implements Resourceble {
@Override
public ContentSettingsFragment.type getType() {
- return this.type;
+ return this.type;
}
public void setImageRes(int imageRes) {
diff --git a/app/src/main/java/app/fedilab/android/animatemenu/util/ViewAnimator.java b/app/src/main/java/app/fedilab/android/animatemenu/util/ViewAnimator.java
index 387ff2e78..cf7aff362 100644
--- a/app/src/main/java/app/fedilab/android/animatemenu/util/ViewAnimator.java
+++ b/app/src/main/java/app/fedilab/android/animatemenu/util/ViewAnimator.java
@@ -36,7 +36,7 @@ public class ViewAnimator {
public static final int CIRCULAR_REVEAL_ANIMATION_DURATION = 500;
private AppCompatActivity appCompatActivity;
-
+
private List list;
private List viewList = new ArrayList<>();
@@ -59,7 +59,6 @@ public class ViewAnimator {
}
-
public void showMenuContent() {
setViewsClickable(false);
viewList.clear();
@@ -67,20 +66,20 @@ public class ViewAnimator {
for (int i = 0; i < size; i++) {
@SuppressLint("InflateParams") View viewMenu = appCompatActivity.getLayoutInflater().inflate(R.layout.menu_list_item, null);
- if( i == SettingsActivity.position){
+ if (i == SettingsActivity.position) {
viewMenu.setBackgroundColor(ContextCompat.getColor(appCompatActivity, R.color.mastodonC2));
- }else {
+ } else {
SharedPreferences sharedpreferences = appCompatActivity.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if (theme == Helper.THEME_DARK) {
viewMenu.setBackgroundResource(R.drawable.menu_item_selector);
- } else if (theme == Helper.THEME_BLACK){
+ } else if (theme == Helper.THEME_BLACK) {
viewMenu.setBackgroundResource(R.drawable.menu_item_selector_black);
- }else {
+ } else {
viewMenu.setBackgroundResource(R.drawable.menu_item_selector_light);
ImageView imageView = viewMenu.findViewById(R.id.menu_item_image);
- if( imageView != null){
+ if (imageView != null) {
changeDrawableColor(appCompatActivity, imageView, R.color.black);
}
}
@@ -104,7 +103,7 @@ public class ViewAnimator {
animatorListener.addViewToContainer(viewMenu);
final double position = i;
final double delay = 3 * ANIMATION_DURATION * (position / size);
- if( screenShotable != null) {
+ if (screenShotable != null) {
new Handler().postDelayed(new Runnable() {
public void run() {
if (position < viewList.size()) {
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/CreateMastodonAccountAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/CreateMastodonAccountAsyncTask.java
index 29f67a4df..5d436c981 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/CreateMastodonAccountAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/CreateMastodonAccountAsyncTask.java
@@ -18,6 +18,7 @@ import android.content.Context;
import android.os.AsyncTask;
import java.lang.ref.WeakReference;
+
import app.fedilab.android.client.API;
import app.fedilab.android.client.APIResponse;
import app.fedilab.android.client.Entities.AccountCreation;
@@ -38,7 +39,7 @@ public class CreateMastodonAccountAsyncTask extends AsyncTask
private WeakReference contextReference;
private String instance;
- public CreateMastodonAccountAsyncTask(Context context, AccountCreation accountCreation, String instance, OnPostStatusActionInterface onPostStatusActionInterface){
+ public CreateMastodonAccountAsyncTask(Context context, AccountCreation accountCreation, String instance, OnPostStatusActionInterface onPostStatusActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostStatusActionInterface;
this.accountCreation = accountCreation;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/CustomSharingAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/CustomSharingAsyncTask.java
index eed54b699..cd1a7d7b3 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/CustomSharingAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/CustomSharingAsyncTask.java
@@ -36,7 +36,7 @@ public class CustomSharingAsyncTask extends AsyncTask {
private OnCustomSharingInterface listener;
private WeakReference contextReference;
- public CustomSharingAsyncTask(Context context, String encodedCustomSharingURL, OnCustomSharingInterface onCustomSharingInterface){
+ public CustomSharingAsyncTask(Context context, String encodedCustomSharingURL, OnCustomSharingInterface onCustomSharingInterface) {
this.contextReference = new WeakReference<>(context);
this.encodedCustomSharingURL = encodedCustomSharingURL;
this.listener = onCustomSharingInterface;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/DeleteDomainsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/DeleteDomainsAsyncTask.java
index c574e03ac..687418135 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/DeleteDomainsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/DeleteDomainsAsyncTask.java
@@ -36,7 +36,7 @@ public class DeleteDomainsAsyncTask extends AsyncTask {
private int response;
private String domainName;
- public DeleteDomainsAsyncTask(Context context, String domainName, OnRetrieveDomainsInterface onRetrieveDomainsInterface){
+ public DeleteDomainsAsyncTask(Context context, String domainName, OnRetrieveDomainsInterface onRetrieveDomainsInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveDomainsInterface;
this.domainName = domainName;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/DownloadTrackingDomainsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/DownloadTrackingDomainsAsyncTask.java
index 0ef71becd..3e5a5bcd2 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/DownloadTrackingDomainsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/DownloadTrackingDomainsAsyncTask.java
@@ -93,7 +93,7 @@ public class DownloadTrackingDomainsAsyncTask extends AsyncTask Toasty.success(context.get(), context.get().getString(R.string.tracking_db_updated), Toast.LENGTH_LONG).show());
else
mainHandler.post(() -> Toasty.error(context.get(), context.get().getString(R.string.toast_error), Toast.LENGTH_LONG).show());
- if( update_tracking_domains != null && update_tracking_domains.get() != null) {
+ if (update_tracking_domains != null && update_tracking_domains.get() != null) {
update_tracking_domains.get().setEnabled(true);
}
}
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/ManageCachedStatusAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/ManageCachedStatusAsyncTask.java
index 4fbf6de66..60189dc59 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/ManageCachedStatusAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/ManageCachedStatusAsyncTask.java
@@ -36,9 +36,7 @@ public class ManageCachedStatusAsyncTask extends AsyncTask {
private WeakReference contextReference;
-
-
- public ManageCachedStatusAsyncTask(Context context, String statusId, OnRefreshCachedStatusInterface onRefreshCachedStatusInterface){
+ public ManageCachedStatusAsyncTask(Context context, String statusId, OnRefreshCachedStatusInterface onRefreshCachedStatusInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRefreshCachedStatusInterface;
this.statusId = statusId;
@@ -48,12 +46,12 @@ public class ManageCachedStatusAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
APIResponse apiResponse = new API(contextReference.get()).getStatusbyIdAndCache(statusId);
- if( apiResponse.getStatuses().size() > 0){
+ if (apiResponse.getStatuses().size() > 0) {
refreshedStatus = apiResponse.getStatuses().get(0);
- if( refreshedStatus != null){
+ if (refreshedStatus != null) {
refreshedStatus.setcached(true);
}
- }else {
+ } else {
refreshedStatus = new app.fedilab.android.client.Entities.Status();
refreshedStatus.setId(statusId);
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/ManageFiltersAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/ManageFiltersAsyncTask.java
index e7151dae7..55d975692 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/ManageFiltersAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/ManageFiltersAsyncTask.java
@@ -32,7 +32,7 @@ import app.fedilab.android.interfaces.OnFilterActionInterface;
public class ManageFiltersAsyncTask extends AsyncTask {
- public enum action{
+ public enum action {
GET_FILTER,
GET_ALL_FILTER,
CREATE_FILTER,
@@ -47,7 +47,7 @@ public class ManageFiltersAsyncTask extends AsyncTask {
private WeakReference contextReference;
private Filters filter;
- public ManageFiltersAsyncTask(Context context, action apiAction, Filters filter, OnFilterActionInterface onFilterActionInterface){
+ public ManageFiltersAsyncTask(Context context, action apiAction, Filters filter, OnFilterActionInterface onFilterActionInterface) {
contextReference = new WeakReference<>(context);
this.listener = onFilterActionInterface;
this.filter = filter;
@@ -59,13 +59,13 @@ public class ManageFiltersAsyncTask extends AsyncTask {
protected Void doInBackground(Void... params) {
if (apiAction == action.GET_ALL_FILTER) {
apiResponse = new API(contextReference.get()).getFilters();
- }else if(apiAction == action.GET_FILTER){
+ } else if (apiAction == action.GET_FILTER) {
apiResponse = new API(contextReference.get()).getFilters(filter.getId());
- }else if(apiAction == action.CREATE_FILTER){
+ } else if (apiAction == action.CREATE_FILTER) {
apiResponse = new API(contextReference.get()).addFilters(filter);
- }else if( apiAction == action.UPDATE_FILTER){
+ } else if (apiAction == action.UPDATE_FILTER) {
apiResponse = new API(contextReference.get()).updateFilters(filter);
- }else if(apiAction == action.DELETE_FILTER){
+ } else if (apiAction == action.DELETE_FILTER) {
statusCode = new API(contextReference.get()).deleteFilters(filter);
}
return null;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/ManageListsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/ManageListsAsyncTask.java
index f6ecac567..a71565434 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/ManageListsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/ManageListsAsyncTask.java
@@ -31,7 +31,7 @@ import app.fedilab.android.interfaces.OnListActionInterface;
public class ManageListsAsyncTask extends AsyncTask {
- public enum action{
+ public enum action {
GET_LIST,
GET_LIST_TIMELINE,
GET_LIST_ACCOUNT,
@@ -56,7 +56,7 @@ public class ManageListsAsyncTask extends AsyncTask {
private int limit;
private String search;
- public ManageListsAsyncTask(Context context, action apiAction, String[] accountsId, String targetedId, String listId, String title, OnListActionInterface onListActionInterface){
+ public ManageListsAsyncTask(Context context, action apiAction, String[] accountsId, String targetedId, String listId, String title, OnListActionInterface onListActionInterface) {
contextReference = new WeakReference<>(context);
this.listener = onListActionInterface;
this.listId = listId;
@@ -66,7 +66,7 @@ public class ManageListsAsyncTask extends AsyncTask {
this.targetedId = targetedId;
}
- public ManageListsAsyncTask(Context context, String listId, String max_id, String since_id, OnListActionInterface onListActionInterface){
+ public ManageListsAsyncTask(Context context, String listId, String max_id, String since_id, OnListActionInterface onListActionInterface) {
contextReference = new WeakReference<>(context);
this.listener = onListActionInterface;
this.listId = listId;
@@ -76,7 +76,7 @@ public class ManageListsAsyncTask extends AsyncTask {
this.apiAction = action.GET_LIST_TIMELINE;
}
- public ManageListsAsyncTask(Context context, String search, OnListActionInterface onListActionInterface){
+ public ManageListsAsyncTask(Context context, String search, OnListActionInterface onListActionInterface) {
contextReference = new WeakReference<>(context);
this.listener = onListActionInterface;
this.search = search;
@@ -87,21 +87,21 @@ public class ManageListsAsyncTask extends AsyncTask {
protected Void doInBackground(Void... params) {
if (apiAction == action.GET_LIST) {
apiResponse = new API(contextReference.get()).getLists();
- }else if(apiAction == action.GET_LIST_TIMELINE){
+ } else if (apiAction == action.GET_LIST_TIMELINE) {
apiResponse = new API(contextReference.get()).getListTimeline(this.listId, this.max_id, this.since_id, this.limit);
- }else if(apiAction == action.GET_LIST_ACCOUNT){
- apiResponse = new API(contextReference.get()).getAccountsInList(this.listId,0);
- }else if( apiAction == action.CREATE_LIST){
+ } else if (apiAction == action.GET_LIST_ACCOUNT) {
+ apiResponse = new API(contextReference.get()).getAccountsInList(this.listId, 0);
+ } else if (apiAction == action.CREATE_LIST) {
apiResponse = new API(contextReference.get()).createList(this.title);
- }else if(apiAction == action.DELETE_LIST){
+ } else if (apiAction == action.DELETE_LIST) {
statusCode = new API(contextReference.get()).deleteList(this.listId);
- }else if(apiAction == action.UPDATE_LIST){
+ } else if (apiAction == action.UPDATE_LIST) {
apiResponse = new API(contextReference.get()).updateList(this.listId, this.title);
- }else if(apiAction == action.ADD_USERS){
+ } else if (apiAction == action.ADD_USERS) {
apiResponse = new API(contextReference.get()).addAccountToList(this.listId, this.accountsId);
- }else if(apiAction == action.DELETE_USERS){
+ } else if (apiAction == action.DELETE_USERS) {
statusCode = new API(contextReference.get()).deleteAccountFromList(this.listId, this.accountsId);
- }else if( apiAction == action.SEARCH_USER){
+ } else if (apiAction == action.SEARCH_USER) {
apiResponse = new API(contextReference.get()).searchAccounts(this.search, 20, true);
}
return null;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/ManagePlaylistsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/ManagePlaylistsAsyncTask.java
index 6d7d0a1da..97300c7e5 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/ManagePlaylistsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/ManagePlaylistsAsyncTask.java
@@ -39,7 +39,7 @@ import app.fedilab.android.sqlite.Sqlite;
public class ManagePlaylistsAsyncTask extends AsyncTask {
- public enum action{
+ public enum action {
GET_PLAYLIST,
GET_LIST_VIDEOS,
CREATE_PLAYLIST,
@@ -59,7 +59,7 @@ public class ManagePlaylistsAsyncTask extends AsyncTask {
private Playlist playlist;
private String videoId;
- public ManagePlaylistsAsyncTask(Context context, action apiAction, Playlist playlist, String videoId, String max_id, OnPlaylistActionInterface onPlaylistActionInterface){
+ public ManagePlaylistsAsyncTask(Context context, action apiAction, Playlist playlist, String videoId, String max_id, OnPlaylistActionInterface onPlaylistActionInterface) {
contextReference = new WeakReference<>(context);
this.listener = onPlaylistActionInterface;
this.apiAction = apiAction;
@@ -78,15 +78,15 @@ public class ManagePlaylistsAsyncTask extends AsyncTask {
Account account = new AccountDAO(contextReference.get(), db).getUniqAccount(userId, instance);
if (apiAction == action.GET_PLAYLIST) {
apiResponse = new PeertubeAPI(contextReference.get()).getPlayists(account.getUsername());
- }else if(apiAction == action.GET_LIST_VIDEOS){
- apiResponse = new PeertubeAPI(contextReference.get()).getPlaylistVideos(playlist.getId(),max_id, null);
- }else if(apiAction == action.DELETE_PLAYLIST){
+ } else if (apiAction == action.GET_LIST_VIDEOS) {
+ apiResponse = new PeertubeAPI(contextReference.get()).getPlaylistVideos(playlist.getId(), max_id, null);
+ } else if (apiAction == action.DELETE_PLAYLIST) {
statusCode = new PeertubeAPI(contextReference.get()).deletePlaylist(playlist.getId());
- }else if(apiAction == action.ADD_VIDEOS){
- statusCode = new PeertubeAPI(contextReference.get()).addVideoPlaylist(playlist.getId(),videoId);
- }else if(apiAction == action.DELETE_VIDEOS){
- statusCode = new PeertubeAPI(contextReference.get()).deleteVideoPlaylist(playlist.getId(),videoId);
- }else if(apiAction == action.GET_PLAYLIST_FOR_VIDEO){
+ } else if (apiAction == action.ADD_VIDEOS) {
+ statusCode = new PeertubeAPI(contextReference.get()).addVideoPlaylist(playlist.getId(), videoId);
+ } else if (apiAction == action.DELETE_VIDEOS) {
+ statusCode = new PeertubeAPI(contextReference.get()).deleteVideoPlaylist(playlist.getId(), videoId);
+ } else if (apiAction == action.GET_PLAYLIST_FOR_VIDEO) {
apiResponse = new PeertubeAPI(contextReference.get()).getPlaylistForVideo(videoId);
}
return null;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/ManagePollAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/ManagePollAsyncTask.java
index 37de25bf6..9f23e061d 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/ManagePollAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/ManagePollAsyncTask.java
@@ -16,6 +16,7 @@ package app.fedilab.android.asynctasks;
import android.content.Context;
import android.os.AsyncTask;
+
import java.lang.ref.WeakReference;
import app.fedilab.android.client.API;
@@ -38,12 +39,12 @@ public class ManagePollAsyncTask extends AsyncTask {
private Poll poll;
private type_s type;
- public enum type_s{
+ public enum type_s {
SUBMIT,
REFRESH
}
- public ManagePollAsyncTask(Context context, type_s type, app.fedilab.android.client.Entities.Status status, int[] choices, OnPollInterface onPollInterface){
+ public ManagePollAsyncTask(Context context, type_s type, app.fedilab.android.client.Entities.Status status, int[] choices, OnPollInterface onPollInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPollInterface;
this.status = status;
@@ -54,16 +55,16 @@ public class ManagePollAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
Poll _poll;
- if( status.getReblog() != null)
+ if (status.getReblog() != null)
_poll = status.getReblog().getPoll();
else
_poll = status.getPoll();
- if( _poll.getId() == null)
+ if (_poll.getId() == null)
return null;
- if (type == type_s.SUBMIT){
- poll = new API(contextReference.get()).submiteVote(_poll.getId(),choices);
- }else if( type == type_s.REFRESH){
+ if (type == type_s.SUBMIT) {
+ poll = new API(contextReference.get()).submiteVote(_poll.getId(), choices);
+ } else if (type == type_s.REFRESH) {
poll = new API(contextReference.get()).getPoll(status);
}
return null;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/PostActionAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/PostActionAsyncTask.java
index 3f4cb538b..1f219fd8d 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/PostActionAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/PostActionAsyncTask.java
@@ -52,21 +52,21 @@ public class PostActionAsyncTask extends AsyncTask {
private Error error;
private StoredStatus storedStatus;
- public PostActionAsyncTask(Context context, API.StatusAction apiAction, StoredStatus storedStatus, OnPostActionInterface onPostActionInterface){
+ public PostActionAsyncTask(Context context, API.StatusAction apiAction, StoredStatus storedStatus, OnPostActionInterface onPostActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface;
this.apiAction = apiAction;
this.storedStatus = storedStatus;
}
- public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, OnPostActionInterface onPostActionInterface){
+ public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, OnPostActionInterface onPostActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface;
this.apiAction = apiAction;
this.targetedId = targetedId;
}
- public PostActionAsyncTask(Context context, Account account, API.StatusAction apiAction, String targetedId, OnPostActionInterface onPostActionInterface){
+ public PostActionAsyncTask(Context context, Account account, API.StatusAction apiAction, String targetedId, OnPostActionInterface onPostActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface;
this.apiAction = apiAction;
@@ -74,7 +74,7 @@ public class PostActionAsyncTask extends AsyncTask {
this.account = account;
}
- public PostActionAsyncTask(Context context, Account account, app.fedilab.android.client.Entities.Status remoteStatus, API.StatusAction apiAction, OnPostActionInterface onPostActionInterface){
+ public PostActionAsyncTask(Context context, Account account, app.fedilab.android.client.Entities.Status remoteStatus, API.StatusAction apiAction, OnPostActionInterface onPostActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface;
this.apiAction = apiAction;
@@ -82,7 +82,7 @@ public class PostActionAsyncTask extends AsyncTask {
this.account = account;
}
- public PostActionAsyncTask(Context context, Account account, Account remoteAccount, API.StatusAction apiAction, OnPostActionInterface onPostActionInterface){
+ public PostActionAsyncTask(Context context, Account account, Account remoteAccount, API.StatusAction apiAction, OnPostActionInterface onPostActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface;
this.apiAction = apiAction;
@@ -90,7 +90,7 @@ public class PostActionAsyncTask extends AsyncTask {
this.account = account;
}
- public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, app.fedilab.android.client.Entities.Status status, String comment, OnPostActionInterface onPostActionInterface){
+ public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, app.fedilab.android.client.Entities.Status status, String comment, OnPostActionInterface onPostActionInterface) {
contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface;
this.apiAction = apiAction;
@@ -98,7 +98,8 @@ public class PostActionAsyncTask extends AsyncTask {
this.comment = comment;
this.status = status;
}
- public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, boolean muteNotifications, OnPostActionInterface onPostActionInterface){
+
+ public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, boolean muteNotifications, OnPostActionInterface onPostActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface;
this.apiAction = apiAction;
@@ -107,7 +108,7 @@ public class PostActionAsyncTask extends AsyncTask {
}
- public PostActionAsyncTask(Context context, String targetedId, String comment, String targetedComment, OnPostActionInterface onPostActionInterface){
+ public PostActionAsyncTask(Context context, String targetedId, String comment, String targetedComment, OnPostActionInterface onPostActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostActionInterface;
this.apiAction = API.StatusAction.PEERTUBEREPLY;
@@ -119,7 +120,7 @@ public class PostActionAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
- if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
+ if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
//Remote action
API api;
if (account != null)
@@ -162,26 +163,24 @@ public class PostActionAsyncTask extends AsyncTask {
}
} else {
if (apiAction == API.StatusAction.REPORT) {
- if( status != null ) {
+ if (status != null) {
statusCode = api.reportAction(status, comment);
- }else{
+ } else {
statusCode = api.reportAction(targetedId, comment);
}
- }
- else if (apiAction == API.StatusAction.CREATESTATUS)
+ } else if (apiAction == API.StatusAction.CREATESTATUS)
statusCode = api.statusAction(status);
- else if(apiAction == API.StatusAction.UPDATESERVERSCHEDULE) {
+ else if (apiAction == API.StatusAction.UPDATESERVERSCHEDULE) {
api.scheduledAction("PUT", storedStatus.getStatus(), null, storedStatus.getScheduledServerdId());
- }
- else if(apiAction == API.StatusAction.DELETESCHEDULED) {
+ } else if (apiAction == API.StatusAction.DELETESCHEDULED) {
api.scheduledAction("DELETE", null, null, storedStatus.getScheduledServerdId());
- }else if (apiAction == API.StatusAction.MUTE_NOTIFICATIONS)
+ } else if (apiAction == API.StatusAction.MUTE_NOTIFICATIONS)
statusCode = api.muteNotifications(targetedId, muteNotifications);
else
statusCode = api.postAction(apiAction, targetedId);
}
error = api.getError();
- }else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
+ } else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
//Remote action
PeertubeAPI peertubeAPI;
if (account != null)
@@ -189,22 +188,22 @@ public class PostActionAsyncTask extends AsyncTask {
else
peertubeAPI = new PeertubeAPI(contextReference.get());
- if( apiAction == API.StatusAction.FOLLOW || apiAction == API.StatusAction.UNFOLLOW)
+ if (apiAction == API.StatusAction.FOLLOW || apiAction == API.StatusAction.UNFOLLOW)
statusCode = peertubeAPI.postAction(apiAction, targetedId);
- else if( apiAction == API.StatusAction.RATEVIDEO )
+ else if (apiAction == API.StatusAction.RATEVIDEO)
statusCode = peertubeAPI.postRating(targetedId, comment);
- else if( apiAction == API.StatusAction.PEERTUBECOMMENT)
+ else if (apiAction == API.StatusAction.PEERTUBECOMMENT)
statusCode = peertubeAPI.postComment(targetedId, comment);
- else if( apiAction == API.StatusAction.PEERTUBEREPLY)
+ else if (apiAction == API.StatusAction.PEERTUBEREPLY)
statusCode = peertubeAPI.postReply(targetedId, comment, targetedComment);
- else if( apiAction == API.StatusAction.PEERTUBEDELETECOMMENT) {
+ else if (apiAction == API.StatusAction.PEERTUBEDELETECOMMENT) {
statusCode = peertubeAPI.deleteComment(targetedId, comment);
targetedId = comment;
- } else if( apiAction == API.StatusAction.PEERTUBEDELETEVIDEO) {
+ } else if (apiAction == API.StatusAction.PEERTUBEDELETEVIDEO) {
statusCode = peertubeAPI.deleteVideo(targetedId);
}
error = peertubeAPI.getError();
- }else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
+ } else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
GNUAPI gnuapi;
if (account != null)
gnuapi = new GNUAPI(contextReference.get(), account.getInstance(), account.getToken());
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/PostAdminActionAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/PostAdminActionAsyncTask.java
index eb7a5f7e6..5fb851811 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/PostAdminActionAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/PostAdminActionAsyncTask.java
@@ -18,6 +18,7 @@ import android.content.Context;
import android.os.AsyncTask;
import java.lang.ref.WeakReference;
+
import app.fedilab.android.client.API;
import app.fedilab.android.client.APIResponse;
import app.fedilab.android.client.Entities.AdminAction;
@@ -25,7 +26,6 @@ import app.fedilab.android.helper.Helper;
import app.fedilab.android.interfaces.OnAdminActionInterface;
-
/**
* Created by Thomas on 18/06/2019.
* Makes actions for post admin calls
@@ -41,8 +41,7 @@ public class PostAdminActionAsyncTask extends AsyncTask {
private AdminAction adminAction;
-
- public PostAdminActionAsyncTask(Context context, API.adminAction action, String id, AdminAction adminAction, OnAdminActionInterface onAdminActionInterface){
+ public PostAdminActionAsyncTask(Context context, API.adminAction action, String id, AdminAction adminAction, OnAdminActionInterface onAdminActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onAdminActionInterface;
this.action = action;
@@ -53,7 +52,7 @@ public class PostAdminActionAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
- switch (action){
+ switch (action) {
case GET_ACCOUNTS:
case GET_ONE_ACCOUNT:
case GET_REPORTS:
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/PostNotificationsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/PostNotificationsAsyncTask.java
index 47426d193..4e056ce81 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/PostNotificationsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/PostNotificationsAsyncTask.java
@@ -36,7 +36,7 @@ public class PostNotificationsAsyncTask extends AsyncTask {
private String targetedId;
private WeakReference contextReference;
- public PostNotificationsAsyncTask(Context context, String targetedId, OnPostNotificationsActionInterface onPostNotificationsActionInterface){
+ public PostNotificationsAsyncTask(Context context, String targetedId, OnPostNotificationsActionInterface onPostNotificationsActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostNotificationsActionInterface;
this.targetedId = targetedId;
@@ -44,7 +44,7 @@ public class PostNotificationsAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
- if( targetedId != null)
+ if (targetedId != null)
apiResponse = new API(this.contextReference.get()).postNoticationAction(targetedId);
else //Delete all notifications
apiResponse = new API(this.contextReference.get()).postNoticationAction(null);
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/PostPeertubeAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/PostPeertubeAsyncTask.java
index 1017c2109..fff8ce4d1 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/PostPeertubeAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/PostPeertubeAsyncTask.java
@@ -33,27 +33,24 @@ import app.fedilab.android.interfaces.OnRetrievePeertubeInterface;
public class PostPeertubeAsyncTask extends AsyncTask {
-
private APIResponse apiResponse;
private OnRetrievePeertubeInterface listener;
private WeakReference contextReference;
private Peertube peertube;
-
- public PostPeertubeAsyncTask(Context context, Peertube peertube, OnRetrievePeertubeInterface onRetrievePeertubeInterface){
+ public PostPeertubeAsyncTask(Context context, Peertube peertube, OnRetrievePeertubeInterface onRetrievePeertubeInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrievePeertubeInterface;
this.peertube = peertube;
}
-
@Override
protected Void doInBackground(Void... params) {
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
apiResponse = peertubeAPI.updateVideo(peertube);
- if( apiResponse != null && apiResponse.getPeertubes() != null && apiResponse.getPeertubes().size() > 0)
+ if (apiResponse != null && apiResponse.getPeertubes() != null && apiResponse.getPeertubes().size() > 0)
apiResponse.getPeertubes().get(0).setUpdate(true);
return null;
}
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/PostStatusAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/PostStatusAsyncTask.java
index 2b8ba2c32..eca84ff98 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/PostStatusAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/PostStatusAsyncTask.java
@@ -48,7 +48,7 @@ public class PostStatusAsyncTask extends AsyncTask {
private WeakReference contextReference;
private UpdateAccountInfoAsyncTask.SOCIAL social;
- public PostStatusAsyncTask(Context context, UpdateAccountInfoAsyncTask.SOCIAL social, Account account, app.fedilab.android.client.Entities.Status status, OnPostStatusActionInterface onPostStatusActionInterface){
+ public PostStatusAsyncTask(Context context, UpdateAccountInfoAsyncTask.SOCIAL social, Account account, app.fedilab.android.client.Entities.Status status, OnPostStatusActionInterface onPostStatusActionInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onPostStatusActionInterface;
this.status = status;
@@ -59,28 +59,28 @@ public class PostStatusAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
- if(social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
+ if (social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
boolean isconnected = Helper.isConnectedToInternet(contextReference.get(), Helper.getLiveInstance(contextReference.get()));
- if( isconnected) {
+ if (isconnected) {
if (account == null) {
apiResponse = new API(this.contextReference.get()).postStatusAction(status);
} else
apiResponse = new API(this.contextReference.get(), account.getInstance(), account.getToken()).postStatusAction(status);
- }else {
+ } else {
apiResponse = new APIResponse();
Error error = new Error();
error.setError(contextReference.get().getString(R.string.no_internet));
error.setStatusCode(-33);
apiResponse.setError(error);
}
- }else {
+ } else {
boolean isconnected = Helper.isConnectedToInternet(contextReference.get(), Helper.getLiveInstance(contextReference.get()));
- if( isconnected) {
+ if (isconnected) {
if (account == null) {
apiResponse = new GNUAPI(this.contextReference.get()).postStatusAction(status);
} else
apiResponse = new GNUAPI(this.contextReference.get(), account.getInstance(), account.getToken()).postStatusAction(status);
- }else {
+ } else {
apiResponse = new APIResponse();
Error error = new Error();
error.setError(contextReference.get().getString(R.string.no_internet));
@@ -90,7 +90,6 @@ public class PostStatusAsyncTask extends AsyncTask {
}
-
return null;
}
@@ -102,21 +101,21 @@ public class PostStatusAsyncTask extends AsyncTask {
@Override
public void run() {
String content = status.getContent();
- if( content != null && content.length() > 0){
+ if (content != null && content.length() > 0) {
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
Matcher matcher = Helper.hashtagPattern.matcher(content);
- while (matcher.find()){
+ while (matcher.find()) {
int matchStart = matcher.start(1);
int matchEnd = matcher.end();
//Get cached tags
List cachedTag = new TagsCacheDAO(contextReference.get(), db).getAll();
String tag = content.substring(matchStart, matchEnd);
- tag = tag.replace("#","");
- if( cachedTag == null){
+ tag = tag.replace("#", "");
+ if (cachedTag == null) {
new TagsCacheDAO(contextReference.get(), db).insert(tag);
- }else {
+ } else {
//If cache doesn't contain the tag and the tag has upper case
- if(!cachedTag.contains(tag) && !tag.toLowerCase().equals(tag)){
+ if (!cachedTag.contains(tag) && !tag.toLowerCase().equals(tag)) {
new TagsCacheDAO(contextReference.get(), db).insert(tag);
}
}
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RemoveAccountAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RemoveAccountAsyncTask.java
index 07ed716a4..cb6fc7bb4 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RemoveAccountAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RemoveAccountAsyncTask.java
@@ -34,7 +34,7 @@ public class RemoveAccountAsyncTask extends AsyncTask {
private WeakReference activityReference;
private Account account;
- public RemoveAccountAsyncTask(Activity activity, Account account){
+ public RemoveAccountAsyncTask(Activity activity, Account account) {
activityReference = new WeakReference<>(activity);
this.account = account;
}
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountAsyncTask.java
index 3575dd528..6b6f03459 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountAsyncTask.java
@@ -42,7 +42,7 @@ public class RetrieveAccountAsyncTask extends AsyncTask {
private Error error;
private WeakReference contextReference;
- public RetrieveAccountAsyncTask(Context context, String targetedId, OnRetrieveAccountInterface onRetrieveAccountInterface){
+ public RetrieveAccountAsyncTask(Context context, String targetedId, OnRetrieveAccountInterface onRetrieveAccountInterface) {
this.contextReference = new WeakReference<>(context);
this.targetedId = targetedId;
this.listener = onRetrieveAccountInterface;
@@ -50,15 +50,15 @@ public class RetrieveAccountAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
- if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
+ if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
API api = new API(this.contextReference.get());
account = api.getAccount(targetedId);
error = api.getError();
- }else if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
+ } else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
account = peertubeAPI.getAccount(targetedId);
error = peertubeAPI.getError();
- }else if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU|| MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
+ } else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
GNUAPI gnuapi = new GNUAPI(this.contextReference.get());
account = gnuapi.getAccount(targetedId);
error = gnuapi.getError();
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountInfoAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountInfoAsyncTask.java
index 90e5f8f7e..5d9f091a9 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountInfoAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountInfoAsyncTask.java
@@ -36,7 +36,7 @@ public class RetrieveAccountInfoAsyncTask extends AsyncTask {
private API api;
private WeakReference contextReference;
- public RetrieveAccountInfoAsyncTask(Context context, OnRetrieveAccountInterface onRetrieveAccountInterface){
+ public RetrieveAccountInfoAsyncTask(Context context, OnRetrieveAccountInterface onRetrieveAccountInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveAccountInterface;
}
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountsAsyncTask.java
index e5c857833..fb88ca2ef 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountsAsyncTask.java
@@ -41,7 +41,7 @@ public class RetrieveAccountsAsyncTask extends AsyncTask {
private WeakReference contextReference;
private String instance, name;
- public enum Type{
+ public enum Type {
BLOCKED,
MUTED,
FOLLOWING,
@@ -53,7 +53,7 @@ public class RetrieveAccountsAsyncTask extends AsyncTask {
GROUPS
}
- public RetrieveAccountsAsyncTask(Context context, String instance, String name, OnRetrieveAccountsInterface onRetrieveAccountsInterface){
+ public RetrieveAccountsAsyncTask(Context context, String instance, String name, OnRetrieveAccountsInterface onRetrieveAccountsInterface) {
this.contextReference = new WeakReference<>(context);
this.instance = instance;
this.name = name;
@@ -61,7 +61,7 @@ public class RetrieveAccountsAsyncTask extends AsyncTask {
this.action = Type.CHANNELS;
}
- public RetrieveAccountsAsyncTask(Context context, Type action, String targetedId, String max_id, OnRetrieveAccountsInterface onRetrieveAccountsInterface){
+ public RetrieveAccountsAsyncTask(Context context, Type action, String targetedId, String max_id, OnRetrieveAccountsInterface onRetrieveAccountsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = action;
this.max_id = max_id;
@@ -69,7 +69,7 @@ public class RetrieveAccountsAsyncTask extends AsyncTask {
this.targetedId = targetedId;
}
- public RetrieveAccountsAsyncTask(Context context, Type action, String max_id, OnRetrieveAccountsInterface onRetrieveAccountsInterface){
+ public RetrieveAccountsAsyncTask(Context context, Type action, String max_id, OnRetrieveAccountsInterface onRetrieveAccountsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = action;
this.max_id = max_id;
@@ -80,16 +80,16 @@ public class RetrieveAccountsAsyncTask extends AsyncTask {
protected Void doInBackground(Void... params) {
API api = null;
GNUAPI gnuapi = null;
- if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
api = new API(this.contextReference.get());
else
gnuapi = new GNUAPI(this.contextReference.get());
- switch (action){
+ switch (action) {
case REBLOGGED:
- if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
assert api != null;
apiResponse = api.getRebloggedBy(targetedId, max_id);
- }else {
+ } else {
assert gnuapi != null;
apiResponse = gnuapi.getRebloggedBy(targetedId, max_id);
}
@@ -99,47 +99,46 @@ public class RetrieveAccountsAsyncTask extends AsyncTask {
apiResponse = api.search2(targetedId, API.searchType.ACCOUNTS, max_id);
break;
case FAVOURITED:
- if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
assert api != null;
apiResponse = api.getFavouritedBy(targetedId, max_id);
- }else {
+ } else {
assert gnuapi != null;
apiResponse = gnuapi.getFavouritedBy(targetedId, max_id);
}
break;
case BLOCKED:
- if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
assert api != null;
apiResponse = api.getBlocks(max_id);
- }else {
+ } else {
assert gnuapi != null;
apiResponse = gnuapi.getBlocks(max_id);
}
break;
case MUTED:
- if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
assert api != null;
apiResponse = api.getMuted(max_id);
- }else {
+ } else {
assert gnuapi != null;
apiResponse = gnuapi.getMuted(max_id);
}
break;
case FOLLOWING:
- if(MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
assert api != null;
apiResponse = api.getFollowing(targetedId, max_id);
- }
- else {
+ } else {
assert gnuapi != null;
apiResponse = gnuapi.getFollowing(targetedId, max_id);
}
break;
case FOLLOWERS:
- if(MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
assert api != null;
apiResponse = api.getFollowers(targetedId, max_id);
- }else {
+ } else {
assert gnuapi != null;
apiResponse = gnuapi.getFollowers(targetedId, max_id);
}
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountsForReplyAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountsForReplyAsyncTask.java
index 24688eaa1..6a02c8910 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountsForReplyAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveAccountsForReplyAsyncTask.java
@@ -43,7 +43,7 @@ public class RetrieveAccountsForReplyAsyncTask extends AsyncTask accounts;
private WeakReference contextReference;
- public RetrieveAccountsForReplyAsyncTask(Context context, app.fedilab.android.client.Entities.Status status, OnRetrieveAccountsReplyInterface onRetrieveAccountsReplyInterface){
+ public RetrieveAccountsForReplyAsyncTask(Context context, app.fedilab.android.client.Entities.Status status, OnRetrieveAccountsReplyInterface onRetrieveAccountsReplyInterface) {
this.contextReference = new WeakReference<>(context);
this.status = status;
this.listener = onRetrieveAccountsReplyInterface;
@@ -59,20 +59,20 @@ public class RetrieveAccountsForReplyAsyncTask extends AsyncTask 0 ) {
+ if (statusContext.getAncestors().size() > 0) {
statusContext = api.getStatusContext(statusContext.getAncestors().get(0).getId());
}
- if( statusContext != null && statusContext.getDescendants().size() > 0){
- for(app.fedilab.android.client.Entities.Status status : statusContext.getDescendants()){
- if( canBeAdded(status.getAccount().getAcct())){
+ if (statusContext != null && statusContext.getDescendants().size() > 0) {
+ for (app.fedilab.android.client.Entities.Status status : statusContext.getDescendants()) {
+ if (canBeAdded(status.getAccount().getAcct())) {
accounts.add(status.getAccount());
addedAccounts.add(status.getAccount().getAcct());
}
}
}
- if( statusContext != null && statusContext.getAncestors().size() > 0){
- for(app.fedilab.android.client.Entities.Status status : statusContext.getAncestors()){
- if( canBeAdded(status.getAccount().getAcct())){
+ if (statusContext != null && statusContext.getAncestors().size() > 0) {
+ for (app.fedilab.android.client.Entities.Status status : statusContext.getAncestors()) {
+ if (canBeAdded(status.getAccount().getAcct())) {
accounts.add(status.getAccount());
addedAccounts.add(status.getAccount().getAcct());
}
@@ -81,7 +81,7 @@ public class RetrieveAccountsForReplyAsyncTask extends AsyncTask {
private Date dateIni;
private Date dateEnd;
- public RetrieveChartsAsyncTask(Context context, Date dateIni, Date dateEnd, OnRetrieveChartsInterface onRetrieveChartsInterface){
+ public RetrieveChartsAsyncTask(Context context, Date dateIni, Date dateEnd, OnRetrieveChartsInterface onRetrieveChartsInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveChartsInterface;
this.dateIni = dateIni;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveContextAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveContextAsyncTask.java
index e2f10d3f9..5041d4f1f 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveContextAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveContextAsyncTask.java
@@ -42,7 +42,7 @@ public class RetrieveContextAsyncTask extends AsyncTask {
private boolean directtimeline;
- public RetrieveContextAsyncTask(Context context, boolean expanded, boolean directtimeline, String statusId, OnRetrieveContextInterface onRetrieveContextInterface){
+ public RetrieveContextAsyncTask(Context context, boolean expanded, boolean directtimeline, String statusId, OnRetrieveContextInterface onRetrieveContextInterface) {
this.contextReference = new WeakReference<>(context);
this.statusId = statusId;
this.listener = onRetrieveContextInterface;
@@ -52,7 +52,7 @@ public class RetrieveContextAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
- if(MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
API api = new API(this.contextReference.get());
statusContext = api.getStatusContext(statusId);
//Retrieves the first toot
@@ -60,7 +60,7 @@ public class RetrieveContextAsyncTask extends AsyncTask {
statusContext = api.getStatusContext(statusContext.getAncestors().get(0).getId());
}
error = api.getError();
- }else{
+ } else {
GNUAPI gnuapi = new GNUAPI(this.contextReference.get());
statusContext = gnuapi.getStatusContext(statusId, directtimeline);
//Retrieves the first toot
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveDomainsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveDomainsAsyncTask.java
index aa019c80d..627afe849 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveDomainsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveDomainsAsyncTask.java
@@ -37,7 +37,7 @@ public class RetrieveDomainsAsyncTask extends AsyncTask {
private APIResponse apiResponse;
private String max_id;
- public RetrieveDomainsAsyncTask(Context context, String max_id, OnRetrieveDomainsInterface onRetrieveDomainsInterface){
+ public RetrieveDomainsAsyncTask(Context context, String max_id, OnRetrieveDomainsInterface onRetrieveDomainsInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveDomainsInterface;
this.max_id = max_id;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveEmojiAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveEmojiAsyncTask.java
index c24657b37..b68eb1a63 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveEmojiAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveEmojiAsyncTask.java
@@ -39,7 +39,7 @@ public class RetrieveEmojiAsyncTask extends AsyncTask {
private OnRetrieveEmojiInterface listener;
private WeakReference contextReference;
- public RetrieveEmojiAsyncTask(Context context, String shortcode, OnRetrieveEmojiInterface onRetrieveEmojiInterface){
+ public RetrieveEmojiAsyncTask(Context context, String shortcode, OnRetrieveEmojiInterface onRetrieveEmojiInterface) {
this.contextReference = new WeakReference<>(context);
this.shortcode = shortcode;
this.listener = onRetrieveEmojiInterface;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFeedsAfterBookmarkAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFeedsAfterBookmarkAsyncTask.java
index 520f9d1bc..50d72cc39 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFeedsAfterBookmarkAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFeedsAfterBookmarkAsyncTask.java
@@ -39,7 +39,7 @@ public class RetrieveFeedsAfterBookmarkAsyncTask extends AsyncTask(context);
this.listener = onRetrieveFeedsAfterBookmarkInterface;
this.max_id = max_id;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFeedsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFeedsAsyncTask.java
index 2768354a9..ecfd032cb 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFeedsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFeedsAsyncTask.java
@@ -64,13 +64,13 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
private boolean showReply = false;
private WeakReference contextReference;
private FilterToots filterToots;
- private String instanceName,remoteInstance, name;
+ private String instanceName, remoteInstance, name;
private boolean cached = false;
private int timelineId;
private String currentfilter;
private String social;
- public enum Type{
+ public enum Type {
HOME,
LOCAL,
DIRECT,
@@ -125,7 +125,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
}
- public RetrieveFeedsAsyncTask(Context context, FilterToots filterToots, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+ public RetrieveFeedsAsyncTask(Context context, FilterToots filterToots, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = Type.CACHE_STATUS;
this.max_id = max_id;
@@ -134,14 +134,14 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
}
- public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+ public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = action;
this.max_id = max_id;
this.listener = onRetrieveFeedsInterface;
}
- public RetrieveFeedsAsyncTask(Context context, Type action, String instanceName, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+ public RetrieveFeedsAsyncTask(Context context, Type action, String instanceName, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = action;
this.max_id = max_id;
@@ -149,7 +149,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
this.instanceName = instanceName;
}
- public RetrieveFeedsAsyncTask(Context context, Type action, int timelineId, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+ public RetrieveFeedsAsyncTask(Context context, Type action, int timelineId, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = action;
this.max_id = max_id;
@@ -157,7 +157,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
this.timelineId = timelineId;
}
- public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, boolean showPinned, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+ public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, boolean showPinned, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = action;
this.max_id = max_id;
@@ -166,7 +166,8 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
this.showMediaOnly = showMediaOnly;
this.showPinned = showPinned;
}
- public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, boolean showPinned, boolean showReply, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+
+ public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, boolean showPinned, boolean showReply, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = action;
this.max_id = max_id;
@@ -176,7 +177,8 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
this.showPinned = showPinned;
this.showReply = showReply;
}
- public RetrieveFeedsAsyncTask(Context context, Type action, String tag, String targetedID, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+
+ public RetrieveFeedsAsyncTask(Context context, Type action, String tag, String targetedID, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.action = action;
this.max_id = max_id;
@@ -185,7 +187,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
this.tag = tag;
}
- public RetrieveFeedsAsyncTask(Context context, String remoteInstance, String name, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+ public RetrieveFeedsAsyncTask(Context context, String remoteInstance, String name, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.remoteInstance = remoteInstance;
this.max_id = max_id;
@@ -194,7 +196,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
this.action = Type.REMOTE_INSTANCE;
}
- public RetrieveFeedsAsyncTask(Context context, RetrieveFeedsParam retrieveFeedsParam, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+ public RetrieveFeedsAsyncTask(Context context, RetrieveFeedsParam retrieveFeedsParam, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveFeedsInterface;
this.action = retrieveFeedsParam.getAction();
@@ -216,9 +218,9 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
protected Void doInBackground(Void... params) {
API api = new API(this.contextReference.get());
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
- if( action == null )
+ if (action == null)
return null;
- switch (action){
+ switch (action) {
case HOME:
apiResponse = api.getHomeTimelineCache(max_id);
break;
@@ -241,70 +243,70 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
apiResponse = api.getConversationTimeline(max_id);
break;
case REMOTE_INSTANCE_FILTERED:
- if( this.social != null && this.social.equals("MASTODON")) {
- apiResponse = api.getPublicTimelineTag(this.currentfilter, true, max_id,this.remoteInstance);
- if( apiResponse != null){
+ if (this.social != null && this.social.equals("MASTODON")) {
+ apiResponse = api.getPublicTimelineTag(this.currentfilter, true, max_id, this.remoteInstance);
+ if (apiResponse != null) {
List statusesTemp = apiResponse.getStatuses();
- if( statusesTemp != null){
- for(app.fedilab.android.client.Entities.Status status: statusesTemp){
+ if (statusesTemp != null) {
+ for (app.fedilab.android.client.Entities.Status status : statusesTemp) {
status.setType(action);
}
}
}
- } else if(this.social != null && this.social.equals("GNU") ) {
+ } else if (this.social != null && this.social.equals("GNU")) {
GNUAPI gnuapi = new GNUAPI(this.contextReference.get());
- apiResponse = gnuapi.searchRemote(this.remoteInstance,currentfilter,max_id);
- }else {
+ apiResponse = gnuapi.searchRemote(this.remoteInstance, currentfilter, max_id);
+ } else {
apiResponse = api.searchPeertube(this.remoteInstance, currentfilter);
}
break;
case REMOTE_INSTANCE:
- if( this.name != null && this.remoteInstance != null){ //For Peertube channels
+ if (this.name != null && this.remoteInstance != null) { //For Peertube channels
apiResponse = api.getPeertubeChannelVideos(this.remoteInstance, this.name);
- }else{ //For other remote instance
+ } else { //For other remote instance
List remoteInstanceObj = new InstancesDAO(this.contextReference.get(), db).getInstanceByName(this.instanceName);
- if( remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("MASTODON")) {
+ if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("MASTODON")) {
apiResponse = api.getPublicTimeline(this.instanceName, true, max_id);
List statusesTemp = apiResponse.getStatuses();
- if( statusesTemp != null){
- for(app.fedilab.android.client.Entities.Status status: statusesTemp){
+ if (statusesTemp != null) {
+ for (app.fedilab.android.client.Entities.Status status : statusesTemp) {
status.setType(action);
}
}
- }else if(remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("MISSKEY")){
+ } else if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("MISSKEY")) {
apiResponse = api.getMisskey(this.instanceName, max_id);
List statusesTemp = apiResponse.getStatuses();
- if( statusesTemp != null){
- for(app.fedilab.android.client.Entities.Status status: statusesTemp){
+ if (statusesTemp != null) {
+ for (app.fedilab.android.client.Entities.Status status : statusesTemp) {
status.setType(action);
}
}
- } else if(remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("PIXELFED") ) {
+ } else if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("PIXELFED")) {
apiResponse = api.getPixelfedTimeline(instanceName, max_id);
- } else if(remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("GNU") ) {
+ } else if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("GNU")) {
apiResponse = api.getGNUTimeline(instanceName, max_id);
- }else {
+ } else {
apiResponse = api.getPeertube(this.instanceName, max_id);
}
}
break;
case FAVOURITES:
- if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
apiResponse = api.getFavourites(max_id);
- }else{
+ } else {
GNUAPI gnuapi = new GNUAPI(this.contextReference.get());
apiResponse = gnuapi.getFavourites(max_id);
}
break;
case USER:
- if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
+ if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
if (showMediaOnly)
apiResponse = api.getStatusWithMedia(targetedID, max_id);
else if (showPinned)
apiResponse = api.getPinnedStatuses(targetedID, max_id);
else
apiResponse = api.getAccountTLStatuses(targetedID, max_id, !showReply);
- }else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
+ } else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
GNUAPI gnuapi = new GNUAPI(this.contextReference.get());
if (showMediaOnly)
apiResponse = gnuapi.getStatusWithMedia(targetedID, max_id);
@@ -312,7 +314,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
apiResponse = gnuapi.getPinnedStatuses(targetedID, max_id);
else
apiResponse = gnuapi.getAccountTLStatuses(targetedID, max_id, !showReply);
- }else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
+ } else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
apiResponse = peertubeAPI.getVideos(targetedID, max_id);
}
@@ -334,20 +336,20 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
break;
case SEARCH:
- if( !tag.contains("_cache_")) {
+ if (!tag.contains("_cache_")) {
apiResponse = api.search2(tag, API.searchType.STATUSES, max_id);
- }else{
- tag = tag.replace("_cache_","");
+ } else {
+ tag = tag.replace("_cache_", "");
apiResponse = new APIResponse();
Results results = new Results();
List statuses = new TimelineCacheDAO(contextReference.get(), db).search(tag, max_id);
- if( statuses != null && statuses.size() > 0 ) {
+ if (statuses != null && statuses.size() > 0) {
apiResponse.setMax_id(statuses.get(statuses.size() - 1).getId());
}
List statusesNew = null;
- if( statuses != null){
+ if (statuses != null) {
statusesNew = new ArrayList<>();
- for(app.fedilab.android.client.Entities.Status status: statuses){
+ for (app.fedilab.android.client.Entities.Status status : statuses) {
if (tag != null && !tag.contains("\"")) {
String[] searches = tag.split(" ");
for (String search : searches) {
@@ -355,7 +357,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
statusesNew.add(status);
}
}
- }else{
+ } else {
statusesNew.addAll(statuses);
}
}
@@ -366,20 +368,20 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
}
break;
case TAG:
- if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
+ if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
ManageTimelines manageTimelines = new TimelinesDAO(contextReference.get(), db).getById(timelineId);
- if( manageTimelines != null && manageTimelines.getTagTimeline() != null){
+ if (manageTimelines != null && manageTimelines.getTagTimeline() != null) {
boolean isArt = manageTimelines.getTagTimeline().isART();
if (isArt)
- apiResponse = api.getCustomArtTimeline(false, manageTimelines.getTagTimeline().getName(), max_id, manageTimelines.getTagTimeline().getAny(), manageTimelines.getTagTimeline().getAll(), manageTimelines.getTagTimeline().getNone());
+ apiResponse = api.getCustomArtTimeline(false, manageTimelines.getTagTimeline().getName(), max_id, manageTimelines.getTagTimeline().getAny(), manageTimelines.getTagTimeline().getAll(), manageTimelines.getTagTimeline().getNone());
else
apiResponse = api.getPublicTimelineTag(manageTimelines.getTagTimeline().getName(), false, max_id, manageTimelines.getTagTimeline().getAny(), manageTimelines.getTagTimeline().getAll(), manageTimelines.getTagTimeline().getNone());
- }else{
+ } else {
apiResponse = api.getPublicTimelineTag(tag, false, max_id, null, null, null);
}
- }else{
+ } else {
GNUAPI gnuapi = new GNUAPI(this.contextReference.get());
- apiResponse = gnuapi.search(tag,max_id);
+ apiResponse = gnuapi.search(tag, max_id);
}
break;
@@ -402,11 +404,11 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
apiResponse = new APIResponse();
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, filterToots, max_id);
- if( statuses != null && statuses.size() > 0) {
+ if (statuses != null && statuses.size() > 0) {
apiResponse.setStatuses(statuses);
apiResponse.setSince_id(statuses.get(0).getId());
apiResponse.setMax_id(statuses.get(statuses.size() - 1).getId());
- }else{
+ } else {
apiResponse.setStatuses(null);
apiResponse.setMax_id(null);
apiResponse.setSince_id(null);
@@ -443,10 +445,10 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
break;
case PF_LOCAL:
api = new API(this.contextReference.get());
- apiResponse = api.getPublicTimeline(true,max_id);
+ apiResponse = api.getPublicTimeline(true, max_id);
case PF_DISCOVER:
api = new API(this.contextReference.get());
- apiResponse = api.getDiscoverTimeline(true,max_id);
+ apiResponse = api.getDiscoverTimeline(true, max_id);
break;
case HASHTAG:
break;
@@ -457,11 +459,11 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
break;
case GNU_LOCAL:
gnuAPI = new GNUAPI(this.contextReference.get());
- apiResponse = gnuAPI.getPublicTimeline(true,max_id);
+ apiResponse = gnuAPI.getPublicTimeline(true, max_id);
break;
case GNU_WHOLE:
gnuAPI = new GNUAPI(this.contextReference.get());
- apiResponse = gnuAPI.getPublicTimeline(false,max_id);
+ apiResponse = gnuAPI.getPublicTimeline(false, max_id);
break;
case GNU_DM:
gnuAPI = new GNUAPI(this.contextReference.get());
@@ -472,7 +474,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask {
apiResponse = gnuAPI.getGroupTimeline(tag.trim(), max_id);
break;
}
- if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
+ if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
List bookmarks = new StatusCacheDAO(contextReference.get(), db).getAllStatusId(StatusCacheDAO.BOOKMARK_CACHE);
if (apiResponse != null && apiResponse.getStatuses() != null && bookmarks != null && apiResponse.getStatuses().size() > 0) {
List statuses = apiResponse.getStatuses();
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFollowRequestSentAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFollowRequestSentAsyncTask.java
index 8cbc3f05b..c6bbb3885 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFollowRequestSentAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveFollowRequestSentAsyncTask.java
@@ -37,7 +37,7 @@ public class RetrieveFollowRequestSentAsyncTask extends AsyncTask contextReference;
- public RetrieveFollowRequestSentAsyncTask(Context context, String max_id, OnRetrieveAccountsInterface onRetrieveAccountsInterface){
+ public RetrieveFollowRequestSentAsyncTask(Context context, String max_id, OnRetrieveAccountsInterface onRetrieveAccountsInterface) {
this.contextReference = new WeakReference<>(context);
this.max_id = max_id;
this.listener = onRetrieveAccountsInterface;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveHowToAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveHowToAsyncTask.java
index 7da41ec45..3c454802a 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveHowToAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveHowToAsyncTask.java
@@ -16,6 +16,7 @@ package app.fedilab.android.asynctasks;
import android.content.Context;
import android.os.AsyncTask;
+
import java.lang.ref.WeakReference;
import app.fedilab.android.client.API;
@@ -36,8 +37,7 @@ public class RetrieveHowToAsyncTask extends AsyncTask {
private WeakReference contextReference;
-
- public RetrieveHowToAsyncTask(Context context, OnRetrieveHowToInterface onRetrieveHowToInterface){
+ public RetrieveHowToAsyncTask(Context context, OnRetrieveHowToInterface onRetrieveHowToInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveHowToInterface;
}
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveInstanceAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveInstanceAsyncTask.java
index fb39f8ee6..099d62777 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveInstanceAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveInstanceAsyncTask.java
@@ -35,7 +35,7 @@ public class RetrieveInstanceAsyncTask extends AsyncTask {
private APIResponse apiResponse;
private WeakReference contextReference;
- public RetrieveInstanceAsyncTask(Context context, OnRetrieveInstanceInterface onRetrieveInstanceInterface){
+ public RetrieveInstanceAsyncTask(Context context, OnRetrieveInstanceInterface onRetrieveInstanceInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveInstanceInterface;
}
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveInstanceRegAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveInstanceRegAsyncTask.java
index e1c001b3e..7a1e74704 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveInstanceRegAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveInstanceRegAsyncTask.java
@@ -36,7 +36,7 @@ public class RetrieveInstanceRegAsyncTask extends AsyncTask {
private WeakReference contextReference;
private String category;
- public RetrieveInstanceRegAsyncTask(Context context, String category, OnRetrieveInstanceInterface onRetrieveInstanceInterface){
+ public RetrieveInstanceRegAsyncTask(Context context, String category, OnRetrieveInstanceInterface onRetrieveInstanceInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveInstanceInterface;
this.category = category;
diff --git a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveManyRelationshipsAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveManyRelationshipsAsyncTask.java
index 94b38e6ab..735c6bfc2 100644
--- a/app/src/main/java/app/fedilab/android/asynctasks/RetrieveManyRelationshipsAsyncTask.java
+++ b/app/src/main/java/app/fedilab/android/asynctasks/RetrieveManyRelationshipsAsyncTask.java
@@ -40,7 +40,7 @@ public class RetrieveManyRelationshipsAsyncTask extends AsyncTask contextReference;
- public RetrieveManyRelationshipsAsyncTask(Context context, List accounts, OnRetrieveManyRelationshipsInterface onRetrieveManyRelationshipsInterface){
+ public RetrieveManyRelationshipsAsyncTask(Context context, List accounts, OnRetrieveManyRelationshipsInterface onRetrieveManyRelationshipsInterface) {
this.contextReference = new WeakReference<>(context);
this.listener = onRetrieveManyRelationshipsInterface;
this.accounts = accounts;
@@ -48,7 +48,7 @@ public class RetrieveManyRelationshipsAsyncTask extends AsyncTask {
private String image, title, description, sharedSubject, sharedText;
private WeakReference contextWeakReference;
private boolean shouldFetchMetaData = true;
- public RetrieveMetaDataAsyncTask(Context context,boolean shouldFetchMetaData, String sharedSubject, String sharedText,String url, OnRetrieveMetaDataInterface onRetrieveRemoteAccountInterface){
+
+ public RetrieveMetaDataAsyncTask(Context context, boolean shouldFetchMetaData, String sharedSubject, String sharedText, String url, OnRetrieveMetaDataInterface onRetrieveRemoteAccountInterface) {
this.url = url;
this.listener = onRetrieveRemoteAccountInterface;
this.sharedText = sharedText;
@@ -56,12 +57,13 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
- if(shouldFetchMetaData)
+ if (shouldFetchMetaData)
return execRetrieveMetaDataInBackground();
else
return null;
}
- private Void execRetrieveMetaDataInBackground(){
+
+ private Void execRetrieveMetaDataInBackground() {
String potentialUrl = "";
if (url == null) {
@@ -77,10 +79,10 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask {
matcher = Patterns.WEB_URL.matcher(url);
else
matcher = Helper.urlPattern.matcher(url);
- while (matcher.find()){
+ while (matcher.find()) {
int matchStart = matcher.start(1);
int matchEnd = matcher.end();
- if(matchStart < matchEnd && url.length() >= matchEnd)
+ if (matchStart < matchEnd && url.length() >= matchEnd)
potentialUrl = url.substring(matchStart, matchEnd);
}
// If we actually have a URL then make use of it.
@@ -103,15 +105,15 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask {
image = matcherImage.group(1);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- if( titleEncoded != null)
+ if (titleEncoded != null)
title = Html.fromHtml(titleEncoded, Html.FROM_HTML_MODE_LEGACY).toString();
- if( descriptionEncoded != null)
+ if (descriptionEncoded != null)
description = Html.fromHtml(descriptionEncoded, Html.FROM_HTML_MODE_LEGACY).toString();
- }else {
+ } else {
//noinspection deprecation
- if( titleEncoded != null)
+ if (titleEncoded != null)
title = Html.fromHtml(titleEncoded).toString();
- if( descriptionEncoded != null)
+ if (descriptionEncoded != null)
description = Html.fromHtml(descriptionEncoded).toString();
}
} catch (NoSuchAlgorithmException e) {
@@ -127,6 +129,7 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask